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
private function getSignupPageTitle($bUserRef, $sFirstName) { $sPageTitle = t('Free Sign Up to Meet Lovely People!'); if ($bUserRef) { $sPageTitle = t('Sign up to meet %0% on %site_name%. The Real Social Dating app!', $sFirstName); } return $sPageTitle; }
Returns the appropriate sign up page title for the registration page. @param bool $bUserRef @param string $sFirstName @return string
getSignupPageTitle
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/user/controllers/SignupController.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/user/controllers/SignupController.php
MIT
private function getSignupHeading($bUserRef, $sFirstName, $sUsername) { $sHeading = t('Sign Up on %site_name%! 🎉'); if ($bUserRef) { $sHeading = t('😍 Sign Up to Meet <span class="pink2">%0%</span> (a.k.a <span class="pink1">%1%</span>) on <span class="pink2">%site_name%</span> 🥰', $sFirstName, $this->str->upperFirst($sUsername)); } return $sHeading; }
Returns the appropriate sign up heading for the registration page. @param bool $bUserRef @param string $sFirstName @param string $sUsername @return string
getSignupHeading
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/user/controllers/SignupController.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/user/controllers/SignupController.php
MIT
private function updateUserMembership($iProfileId, stdClass $oUser, UserCoreModel $oUserModel) { if (!$this->str->equals($this->httpRequest->post('group_id'), $oUser->groupId)) { $oUserModel->updateMembership( $this->httpRequest->post('group_id'), $iProfileId, $this->dateTime->get()->dateTime(UserCoreModel::DATETIME_FORMAT) ); $this->clearFieldCache('membershipDetails', $iProfileId); } }
Allow admins to update user's membership. @param int $iProfileId @param stdClass $oUser @param UserCoreModel $oUserModel @return void @throws Framework\Mvc\Request\WrongRequestMethodException
updateUserMembership
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/user/forms/processing/EditFormProcess.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/user/forms/processing/EditFormProcess.php
MIT
private function notFound($b404Status = true) { if ($b404Status === true) { Http::setHeadersByCode(StatusCode::NOT_FOUND); } $sErrMsg = ''; if ($b404Status === true) { $sForumHomepageUrl = Uri::get('forum', 'forum', 'index'); $sErrMsg = '<br />' . t('Please return to the <a href="%0%">main forum page</a> or <a href="%1%">the previous page</a>.', $sForumHomepageUrl, 'javascript:history.back();'); } $this->view->page_title = $this->sTitle; $this->view->h2_title = $this->sTitle; $this->view->error = $this->sTitle . $sErrMsg; }
Set a Not Found Error Message with HTTP 404 Code Status. @param bool $b404Status For the Ajax blocks profile, we can not put HTTP error code 404, so the attribute must be set to "false". @return void
notFound
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/forum/controllers/ForumController.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/forum/controllers/ForumController.php
MIT
public function deleteCategory($iCategoryId) { // Topics of Forums & Messages of Topics $this->delMsgsTopicsFromCatId($iCategoryId); // Forums of Category $rStmt = Db::getInstance()->prepare( 'DELETE FROM' . Db::prefix(DbTableName::FORUM) . 'WHERE categoryId = :categoryId' ); $rStmt->bindValue(':categoryId', $iCategoryId, PDO::PARAM_INT); $rStmt->execute(); // Category $rStmt = Db::getInstance()->prepare( 'DELETE FROM' . Db::prefix(DbTableName::FORUM_CATEGORY) . 'WHERE categoryId = :categoryId LIMIT 1' ); $rStmt->bindValue(':categoryId', $iCategoryId, PDO::PARAM_INT); return $rStmt->execute(); }
Deletes the category and forums, topics and posts in it. @param int $iCategoryId @return bool Returns TRUE on success or FALSE on failure.
deleteCategory
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/forum/models/ForumModel.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/forum/models/ForumModel.php
MIT
public function deleteForum($iForumId) { // Messages of Topics $this->delMsgsFromForumId($iForumId); // Topics of Forum $rStmt = Db::getInstance()->prepare( 'DELETE FROM' . Db::prefix(DbTableName::FORUM_TOPIC) . 'WHERE forumId = :forumId' ); $rStmt->bindValue(':forumId', $iForumId, PDO::PARAM_INT); $rStmt->execute(); // Forum $rStmt = Db::getInstance()->prepare( 'DELETE FROM' . Db::prefix(DbTableName::FORUM) . 'WHERE forumId = :forumId LIMIT 1' ); $rStmt->bindValue(':forumId', $iForumId, PDO::PARAM_INT); return $rStmt->execute(); }
Deletes the forum and the topics and posts in it. @param int $iForumId @return bool Returns TRUE on success or FALSE on failure.
deleteForum
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/forum/models/ForumModel.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/forum/models/ForumModel.php
MIT
public function deleteTopic($iProfileId, $iTopicId) { // Messages of Topic $rStmt = Db::getInstance()->prepare( 'DELETE FROM' . Db::prefix(DbTableName::FORUM_MESSAGE) . 'WHERE profileId = :profileId AND topicId = :topicId' ); $rStmt->bindValue(':profileId', $iProfileId, PDO::PARAM_INT); $rStmt->bindValue(':topicId', $iTopicId, PDO::PARAM_INT); $rStmt->execute(); // Topic $rStmt = Db::getInstance()->prepare( 'DELETE FROM' . Db::prefix(DbTableName::FORUM_TOPIC) . 'WHERE profileId = :profileId AND topicId = :topicId LIMIT 1' ); $rStmt->bindValue(':profileId', $iProfileId, PDO::PARAM_INT); $rStmt->bindValue(':topicId', $iTopicId, PDO::PARAM_INT); return $rStmt->execute(); }
Deletes the topic and posts in it. @param int $iProfileId @param int $iTopicId @return bool Returns TRUE on success or FALSE on failure.
deleteTopic
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/forum/models/ForumModel.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/forum/models/ForumModel.php
MIT
public function checkWaitTopic($iProfileId, $iWaitTime, $sCurrentTime) { $rStmt = Db::getInstance()->prepare( 'SELECT topicId FROM' . Db::prefix(DbTableName::FORUM_TOPIC) . 'WHERE profileId = :profileId AND DATE_ADD(createdDate, INTERVAL :waitTime MINUTE) > :currentTime LIMIT 1' ); $rStmt->bindValue(':profileId', $iProfileId, PDO::PARAM_INT); $rStmt->bindValue(':waitTime', $iWaitTime, PDO::PARAM_INT); $rStmt->bindValue(':currentTime', $sCurrentTime, PDO::PARAM_STR); $rStmt->execute(); return $rStmt->rowCount() === 0; }
To prevent spam! Waiting time to send a new topic in the forum. @param int $iProfileId @param int $iWaitTime In minutes! @param string $sCurrentTime In date format: 0000-00-00 00:00:00 @return bool Return TRUE if the weather was fine, otherwise FALSE
checkWaitTopic
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/forum/models/ForumModel.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/forum/models/ForumModel.php
MIT
public function checkWaitReply($iTopicId, $iProfileId, $iWaitTime, $sCurrentTime) { $rStmt = Db::getInstance()->prepare( 'SELECT messageId FROM' . Db::prefix(DbTableName::FORUM_MESSAGE) . 'WHERE topicId = :topicId AND profileId = :profileId AND DATE_ADD(createdDate, INTERVAL :waitTime MINUTE) > :currentTime LIMIT 1' ); $rStmt->bindValue(':topicId', $iTopicId, PDO::PARAM_INT); $rStmt->bindValue(':profileId', $iProfileId, PDO::PARAM_INT); $rStmt->bindValue(':waitTime', $iWaitTime, PDO::PARAM_INT); $rStmt->bindValue(':currentTime', $sCurrentTime, PDO::PARAM_STR); $rStmt->execute(); return $rStmt->rowCount() === 0; }
To prevent spam! Waiting time to send a reply message in the same topic. @param int $iTopicId @param int $iProfileId @param int $iWaitTime In minutes! @param string $sCurrentTime In date format: 0000-00-00 00:00:00 @return bool Return TRUE if the weather was fine, otherwise FALSE
checkWaitReply
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/forum/models/ForumModel.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/forum/models/ForumModel.php
MIT
protected function getForumIdsFromCatId($iCategoryId) { $rStmt = Db::getInstance()->prepare( 'SELECT forumId FROM' . Db::prefix(DbTableName::FORUM) . 'WHERE categoryId = :categoryId' ); $rStmt->bindValue(':categoryId', $iCategoryId, PDO::PARAM_INT); $rStmt->execute(); return $rStmt->fetchAll(PDO::FETCH_OBJ); }
Get Forum IDs from Category ID. @param int $iCategoryId @return array
getForumIdsFromCatId
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/forum/models/ForumModel.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/forum/models/ForumModel.php
MIT
private function sendMail($iId, UserCoreModel $oUserModel) { $sFriendEmail = $oUserModel->getEmail($iId); $sFriendUsername = $oUserModel->getUsername($iId); /** * Note: The predefined variables as %site_name% does not work here, * because we are in an ajax script that is called before the definition of these variables. */ /** * Get the site name, because we do not have access to predefined variables. */ $sSiteName = DbConfig::getSetting('siteName'); $this->view->content = t('Hello %0%!', $sFriendUsername) . '<br />' . t('<strong>%0%</strong> sent you a friendship request on %1%.', $this->session->get('member_username'), $sSiteName) . '<br />' . t('<a href="%0%">Click here</a> to see your friend request.', Uri::get('friend', 'main', 'index')); /** * @internal Because this class is called through ajax router, "PH7_TPL_NAME" isn't defined yet. * So, it uses the "PH7_DEFAULT_THEME" constant, which is already defined. */ $sMessageHtml = $this->view->parseMail( PH7_PATH_SYS . 'global/' . PH7_VIEWS . PH7_DEFAULT_THEME . '/tpl/mail/sys/mod/friend/friend_request.tpl', $sFriendEmail ); $aInfo = [ 'to' => $sFriendEmail, 'subject' => t('%0% wants to be friends with you on %1%', $this->session->get('member_first_name'), $sSiteName) ]; (new Mail)->send($aInfo, $sMessageHtml); }
Send an email to warn the friend request. @param int $iId friend ID @param UserCoreModel $oUserModel @return void
sendMail
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/friend/assets/ajax/FriendAjax.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/friend/assets/ajax/FriendAjax.php
MIT
private function updateAffiliateCommission() { // Load the Affiliate config file $this->config->load(PH7_PATH_SYS_MOD . 'affiliate' . PH7_DS . PH7_CONFIG . PH7_CONFIG_FILE); $iAffId = $this->oUserModel->getAffiliatedId($this->iProfileId); if ($iAffId < 1) { // If there is no valid ID, we stop the method return; } $iAffCom = $this->getAffiliateCommissionAmount(); if ($iAffCom > 0) { // If commission amount is higher than 0, we update the user's commission $this->oUserModel->updateUserJoinCom($iAffId, $iAffCom); } }
Update the Affiliate Commission. @return void
updateAffiliateCommission
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/payment/controllers/MainController.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/payment/controllers/MainController.php
MIT
private function getAffiliateCommissionAmount() { $iAmount = $this->oUserModel->readProfile($this->iProfileId)->price; return $iAmount * $this->config->values['module.setting']['rate.user_membership_payment'] / 100; }
Get the affiliate's commission amount. @return float|int
getAffiliateCommissionAmount
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/payment/controllers/MainController.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/payment/controllers/MainController.php
MIT
private function setAutoRedirectionToHomepage() { $this->design->setRedirect( $this->registry->site_url, null, null, self::REDIRECTION_DELAY ); }
Set automatic redirection to homepage if payment was successful. @return void
setAutoRedirectionToHomepage
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/payment/controllers/MainController.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/payment/controllers/MainController.php
MIT
public static function undeletable($iMembershipId, $iDefaultMembershipId = null) { if ($iDefaultMembershipId === null) { $iDefaultMembershipId = (int)DbConfig::getSetting('defaultMembershipGroupId'); } $aUndeletableGroups = self::UNDELETABLE_GROUP_IDS; $aUndeletableGroups[] = $iDefaultMembershipId; $iMembershipId = (int)$iMembershipId; return in_array($iMembershipId, $aUndeletableGroups, true); }
Checks if a membership group can be deleted or not. @param int $iMembershipId @param int|null $iDefaultMembershipId Specify another value than the default membership ID set. Optional. @return bool
undeletable
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/payment/inc/class/GroupId.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/payment/inc/class/GroupId.php
MIT
public function buttonStripe(stdClass $oMembership) { $oStripe = new Stripe; $oStripe ->param('item_number', $oMembership->groupId) ->param('amount', $oMembership->price); echo '<form action="', $oStripe->getUrl(), '" method="post">', $oStripe->generate(), '<script src="', Stripe::JS_LIBRARY_URL, '" class="stripe-button" data-key="', $this->config->values['module.setting']['stripe.publishable_key'], '" data-name="', $this->registry->site_name, '" data-description="', $oMembership->name, '" data-amount="', Stripe::getAmount($oMembership->price), '" data-currency="', $this->config->values['module.setting']['currency_code'], '" data-allow-remember-me="true"> </script> </form>'; unset($oStripe); }
Generates Stripe payment form Stripe API. @param stdClass $oMembership @return void
buttonStripe
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/payment/inc/class/design/PaymentDesign.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/payment/inc/class/design/PaymentDesign.php
MIT
public function buttonBraintree(stdClass $oMembership) { $fPrice = $oMembership->price; $sCurrency = $this->config->values['module.setting']['currency_code']; $sLocale = PH7_LANG_NAME; Braintree::init($this->config); $sClientToken = Braintree_ClientToken::generate(); echo '<script src="', Braintree::JS_LIBRARY_URL, '"></script>'; $oBraintree = new Braintree; $oBraintree ->param('item_number', $oMembership->groupId) ->param('amount', $fPrice); $this->displayGatewayForm($oBraintree, $oMembership->name, '<u>Braintree</u>'); unset($oBraintree); echo '<script>'; echo '$(function () {'; echo "braintree.setup('$sClientToken', 'dropin', {"; echo "container: '" . self::DIV_CONTAINER_NAME . "',"; echo "paypal: {singleUse: true, amount: '$fPrice', currency: '$sCurrency', locale: '$sLocale'}"; echo '})})'; echo '</script>'; }
Generates Braintree payment form Braintree API. @param stdClass $oMembership @return void
buttonBraintree
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/payment/inc/class/design/PaymentDesign.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/payment/inc/class/design/PaymentDesign.php
MIT
public function refer() { if ($this->httpRequest->getExists('aff')) { $this->addReferer(); } $this->redirectToWebsite(); }
Set the reference to the visitor. @return void
refer
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/affiliate/controllers/RouterController.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/affiliate/controllers/RouterController.php
MIT
private function redirectToWebsite() { $sUrl = $this->registry->site_url . $this->httpRequest->get('action'); Header::redirect($sUrl); }
Redirect the user to the website's homepage or a specific page if GET 'action' is specified. @return void
redirectToWebsite
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/affiliate/controllers/RouterController.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/affiliate/controllers/RouterController.php
MIT
private function setPageInfo($sPageTitle) { $this->view->page_title = $sPageTitle; $this->view->meta_description = $sPageTitle; $this->view->h1_title = $sPageTitle; }
Set page title to page name, meta description and page heading. @param string $sPageTitle @return void
setPageInfo
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/affiliate/controllers/SignupController.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/affiliate/controllers/SignupController.php
MIT
public function sendMail(array $aInfo, $bIsUniversalLogin = false) { $this->oView->content = t('Dear %0% %1%, welcome to affiliate platform %site_name%!', $aInfo['last_name'], $aInfo['first_name']) . '<br />' . t('Hello %0%! We are proud to welcome you as an affiliate on our %site_name%!', $aInfo['first_name']) . '<br />' . $this->getEmailMsg($aInfo) . '<br /><span style="text-decoration:underline">' . t('Please save the following information for future reference:') . '</span><br /><em>' . t('Email: %0%.', $aInfo['email']) . '<br />' . t('Username: %0%.', $aInfo['username']) . '<br />' . t('Password: ****** (This field is hidden to protect against theft of your account. If you have forgotten your password, please request a new one <a href="%0%">here</a>).', Uri::get('lost-password', 'main', 'forgot', 'affiliate')) . '</em>'; $this->oView->footer = t('You are receiving this email because we received a registration application with "%0%" email address for %site_name% (%site_url%).', $aInfo['email']) . '<br />' . t('If you think someone has used your email address without your knowledge to create an account on %site_name%, please contact us using our contact form available on our website.'); $sMsgHtml = $this->oView->parseMail(PH7_PATH_SYS . 'global/' . PH7_VIEWS . PH7_TPL_MAIL_NAME . '/tpl/mail/sys/mod/affiliate/registration.tpl', $aInfo['email']); $aMailInfo = [ 'to' => $aInfo['email'], 'subject' => t('Dear %0% %1%, Welcome to our affiliate platform!', $aInfo['last_name'], $aInfo['first_name']) ]; (new Mail)->send($aMailInfo, $sMsgHtml); return $this; }
Send the confirmation email with registration details. @param array $aInfo @param bool $bIsUniversalLogin @return self
sendMail
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/affiliate/inc/class/Registration.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/affiliate/inc/class/Registration.php
MIT
public function checkModFolder($sSwitch, $sFolder) { $sValue = $this->checkParam($sSwitch); $sFullPath = ($sValue === static::INSTALL) ? PH7_PATH_REPOSITORY . static::DIR . PH7_DS . $sFolder : PH7_PATH_MOD . $sFolder; return !preg_match(static::REGEX_MODULE_FOLDER_FORMAT, $sFolder) || !is_file($sFullPath . PH7_CONFIG . PH7_CONFIG_FILE) || (PH7_PATH_REPOSITORY . static::DIR . PH7_DS . $sFolder === PH7_PATH_MOD . $sFolder) ? false : true; }
Checks if the module is valid. @param string $sSwitch Module::INSTALL or Module::UNINSTALL constant. @param string $sFolder The folder @return bool Returns TRUE if it is correct, FALSE otherwise.
checkModFolder
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/inc/class/Module.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/inc/class/Module.php
MIT
public function readConfig($sSwitch, $sFolder) { $sValue = $this->checkParam($sSwitch); $sPath = ($sValue === static::INSTALL) ? PH7_PATH_REPOSITORY . static::DIR . PH7_DS . $sFolder : PH7_PATH_MOD . $sFolder; return Config::getInstance()->load($sPath . PH7_CONFIG . PH7_CONFIG_FILE); }
Get the module information in the config.ini file. @param string $sSwitch Module::INSTALL or Module::UNINSTALL constant. @param string $sFolder @return bool
readConfig
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/inc/class/Module.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/inc/class/Module.php
MIT
private function file($sSwitch) { if ($sSwitch === static::INSTALL) { $this->oFile->systemRename(PH7_PATH_REPOSITORY . static::DIR . PH7_DS . $this->sModsDirModFolder, PH7_PATH_MOD); // Files of module $this->oFile->chmod(PH7_PATH_MOD . $this->sModsDirModFolder, Chmod::MODE_ALL_EXEC); } else { $this->oFile->systemRename(PH7_PATH_MOD . $this->sModsDirModFolder, PH7_PATH_REPOSITORY . static::DIR . PH7_DS); // Files of module $this->oFile->chmod(PH7_PATH_REPOSITORY . static::DIR . PH7_DS . $this->sModsDirModFolder, Chmod::MODE_ALL_EXEC); } }
FOR INSTALL: Movement of the back module of the repository to the modules directory OR FOR UNINSTALL: Movement of the back module of the modules directory to the repository. @param string $sSwitch Module::INSTALL or Module::UNINSTALL constant. @return void
file
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/inc/class/Module.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/inc/class/Module.php
MIT
private function route($sSwitch) { $this->sModRoutePath = PH7_PATH_MOD . $this->sModsDirModFolder . static::INSTALL_DIR . PH7_DS . static::ROUTE_FILE; if (is_file($this->sModRoutePath)) { ($sSwitch === static::INSTALL) ? $this->addRoute() : $this->removeRoute(); // Refresh the route file XML to take into account the new URL rules Uri::clearCache('routefile'); } }
Add or remove the routes module. @param string $sSwitch Module::INSTALL or Module::UNINSTALL constant. @return void
route
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/inc/class/Module.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/inc/class/Module.php
MIT
private function addRoute() { $sRoute = $this->oFile->getFile($this->sRoutePath); $sModRoute = $this->oFile->getFile($this->sModRoutePath); $sNewRoute = str_replace('</routes>', '', $sRoute); $sNewRoute .= $sModRoute . F\File::EOL . '</routes>'; return $this->oFile->putFile($this->sRoutePath, $sNewRoute); }
Add the module routes in the global configs/routes/<lang>.xml file. @return bool
addRoute
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/inc/class/Module.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/inc/class/Module.php
MIT
private function removeRoute() { $sRoute = $this->oFile->getFile($this->sRoutePath); $sModRoute = $this->oFile->getFile($this->sModRoutePath); $sNewRoute = str_replace($sModRoute . F\File::EOL, '', $sRoute); return $this->oFile->putFile($this->sRoutePath, $sNewRoute); }
Remove the module routes in the global configs/routes/<lang>.xml file. @return bool
removeRoute
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/inc/class/Module.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/inc/class/Module.php
MIT
private function removeModDir($sModuleDir) { return $this->oFile->deleteDir(PH7_PATH_REPOSITORY . static::DIR . PH7_DS . $sModuleDir); }
Remove the module repository folder. @param string $sModuleDir Folder of module. @return bool Returns TRUE if the folder has been deleted, FALSE otherwise.
removeModDir
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/inc/class/Module.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/inc/class/Module.php
MIT
private function checkParam($sSwitch) { if ($sSwitch === static::INSTALL) { return static::INSTALL; } if ($sSwitch === static::UNINSTALL) { return static::UNINSTALL; } $sMsg = sprintf( 'Wrong value in the parameter of the method: %s in the class: %s', __METHOD__, __CLASS__ ); exit($sMsg); }
Checks if the constant is correct. Note: This method is valid only for public methods, it is not necessary to check the private methods. @param string $sSwitch The check constant. @return string Returns the constant if it is correct, otherwise an error message with exit() function.
checkParam
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/inc/class/Module.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/inc/class/Module.php
MIT
public function adminLogin($sEmail, $sUsername, $sPassword) { $rStmt = Db::getInstance()->prepare('SELECT password FROM' . Db::prefix(DbTableName::ADMIN) . 'WHERE email = :email AND username = :username LIMIT 1'); $rStmt->bindValue(':email', $sEmail, PDO::PARAM_STR); $rStmt->bindValue(':username', $sUsername, PDO::PARAM_STR); $rStmt->execute(); $sHashedPassword = $rStmt->fetchColumn(); Db::free($rStmt); return Security::checkPwd($sPassword, $sHashedPassword); }
It recreates an admin method more complicated and more secure than the classic one PH7\UserCoreModel::login() @param string $sEmail @param string $sUsername @param string $sPassword @return bool Returns TRUE if successful otherwise FALSE
adminLogin
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/models/AdminModel.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/models/AdminModel.php
MIT
public function run($sSqlModuleFile) { return Various::execQueryFile($sSqlModuleFile); }
Executes sql queries for the module of the software. @param string $sSqlModuleFile File SQL @return bool|array Returns TRUE if there are no errors, otherwise returns an ARRAY of error information.
run
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/models/ModuleModel.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/models/ModuleModel.php
MIT
private function clearBrowserCache() { $this->browser->noCache(); }
Clear the Web browser's cache. @return void
clearBrowserCache
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/assets/ajax/CacheAjax.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/assets/ajax/CacheAjax.php
MIT
private static function generateLanguageSwitchField(\PFBC\Form $oForm) { $aLangs = (new File)->getDirList(PH7_PATH_APP_LANG); $iTotalLangs = count($aLangs); if ($iTotalLangs > 1) { $oForm->addElement(new HTMLExternal('<div class="center divShow">')); $oForm->addElement(new HTMLExternal('<h3 class="underline"><a href="#showDiv_listLang" title="' . t('Click here to show/hide the languages') . '">' . t('Change language for the Meta Tags') . '</a></h3>')); $oForm->addElement(new HTMLExternal('<ul class="hidden" id="showDiv_listLang">')); for ($iLangIndex = 0; $iLangIndex < $iTotalLangs; $iLangIndex++) { $sAbbrLang = Lang::getIsoCode($aLangs[$iLangIndex]); $oForm->addElement(new HTMLExternal('<li>' . ($iLangIndex + 1) . ') ' . '<a class="bold" href="' . Uri::get(PH7_ADMIN_MOD, 'setting', 'metamain', $aLangs[$iLangIndex], false) . '" title="' . t($sAbbrLang) . '">' . t($sAbbrLang) . ' (' . $aLangs[$iLangIndex] . ')</a></li>')); } $oForm->addElement(new HTMLExternal('</ul></div>')); }
Generate the list of languages that allows admins to switch to another language on the meta tags form. @param \PFBC\Form $oForm @return void
generateLanguageSwitchField
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/forms/MetaMainForm.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/forms/MetaMainForm.php
MIT
private function clearCache() { (new Cache)->start(Design::CACHE_STATIC_GROUP, 'analyticsApi1', null)->clear(); }
Clear the 'active' "analyticsApi" data @return void
clearCache
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/forms/processing/AnalyticsApiFormProcess.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/forms/processing/AnalyticsApiFormProcess.php
MIT
private function updateLogo() { if ($this->isLogoUploaded()) { $oLogo = new FileStorageImage($_FILES['logo']['tmp_name']); if (!$oLogo->validate()) { \PFBC\Form::setError('form_setting', Form::wrongImgFileTypeMsg()); $this->bIsErr = true; } else { /** * @internal File::deleteFile() first tests if the file exists, and then deletes it. */ $sPathName = PH7_PATH_TPL . PH7_TPL_NAME . PH7_DS . PH7_IMG . self::LOGO_FILENAME; $this->file->deleteFile($sPathName); // It erases the old logo. $oLogo->dynamicResize(self::LOGO_WIDTH, self::LOGO_HEIGHT); $oLogo->save($sPathName); // Clear CSS cache, because the logo is stored with data URI in the CSS cache file $this->file->deleteDir(PH7_PATH_CACHE . Gzip::CACHE_DIR); // Clear the Web browser's cache $this->browser->noCache(); } } }
Update Logo (if a new one if uploaded only).
updateLogo
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/forms/processing/SettingFormProcess.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/forms/processing/SettingFormProcess.php
MIT
private function updateFields(stdClass $oMeta) { foreach (self::$aMetaFields as $sKey => $sVal) { if (!$this->str->equals($this->httpRequest->post($sKey), $oMeta->$sVal)) { $sParam = ($sKey == 'promo_text') ? Http::ONLY_XSS_CLEAN : null; DbConfig::setMetaMain($sVal, $this->httpRequest->post($sKey, $sParam), $oMeta->langId); } } }
Update the fields in the DB (if modified only). @param stdClass $oMeta Meta Main DB data.
updateFields
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/system/modules/admin123/forms/processing/MetaMainFormProcess.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/system/modules/admin123/forms/processing/MetaMainFormProcess.php
MIT
function html_body($sTitle, $sMsg) { // Send headers to not cache the page header('Cache-Control: no-store, no-cache, must-revalidate'); header('Expires: Thu, 01 Jan 1970 00:00:00 GMT'); return '<!DOCTYPE html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><title>' . $sTitle . '</title><meta name="author" content="pH7Builder, Pierre-Henry Soria"><meta name="copyright" content="(c) 2012-' . date('Y') . ', Pierre-Henry Soria. All Rights Reserved"><meta name="creator" content="pH7Builder, Pierre-Henry Soria"><meta name="designer" content="pH7Builder, Pierre-Henry Soria"><meta name="generator" content="pH7Builder"><style>body{background:#EFEFEF;color:#555;font:normal 12px Arial,Helvetica,sans-serif;margin:0;padding:0}.center{margin-left:auto;margin-right:auto;text-align:center;width:80%}.error,.warning{font-weight:bold;font-size:13px;color:red}.warning{text-transform:uppercase}.italic{font-style:italic}.underline{text-decoration:underline}a{color:#08c;outline-style:none;cursor:pointer}a:link,a:visited{text-decoration:none}a:hover,a:active{color:#F24C9E;text-decoration:underline}</style></head><body><div class="center">' . $sMsg . '</div></body></html>'; }
Display a basic HTML body page. Since it will display a dynamic page, it will also send headers to not cache the page @param string $sTitle Title of the page. @param string $sMsg Message to display to the page. @return string The HTML body.
html_body
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/includes/helpers/misc.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/includes/helpers/misc.php
MIT
public static function getVal($sValue) { $aVal = []; $aValue = explode(Db::SET_DELIMITER, $sValue); foreach ($aValue as $sVal) { $aVal[] = $sVal; } return $aVal; }
To get Value Data from the database. @param string $sValue @return array
getVal
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/includes/classes/Form.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/includes/classes/Form.php
MIT
public static function setVal($aValue) { $sVal = ''; // Default Value foreach ($aValue as $sValue) { $sVal .= $sValue . Db::SET_DELIMITER; } return rtrim($sVal, Db::SET_DELIMITER); // Removes the MySQL SET's delimiter }
To set Value Data into the database. @param array $aValue @return string
setVal
php
pH7Software/pH7-Social-Dating-CMS
_protected/app/includes/classes/Form.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/app/includes/classes/Form.php
MIT
public function lowerFirst($sText) { return lcfirst($sText); }
Make a string's first character lowercase. @param string $sText @return string
lowerFirst
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public function length($sText) { return mb_strlen($sText, PH7_ENCODING); }
Count the length of a string and supports the special characters (Asian, Latin, ...). @param string $sText @return int
length
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public function equals($sText1, $sText2) { //return strcmp($sText1, $sText2) === 0; return $sText1 === $sText2; }
Test the equality of two strings. @personal For the PHP AND C functions, strcmp and strcasecmp returns a positive or negative integer value if they are different and 0 if they are equal. @param string $sText1 @param string $sText2 @return bool
equals
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public function equalsIgnoreCase($sText1, $sText2) { //return strcasecmp($sText1, $sText2) === 0; $sText1 = $this->lower($sText1); $sText2 = $this->lower($sText2); return $this->equals($sText1, $sText2); }
Equals but not case sensitive. Accepts uppercase and lowercase. @param string $sText1 @param string $sText2 @return bool
equalsIgnoreCase
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public function indexOf($sText, $sFindText, $iOffset = 0) { $mPosition = strpos($sText, $sFindText, $iOffset); if (!is_int($mPosition)) { return -1; } return $mPosition; }
Find the position of the first occurrence of a specified value in a string. @param string $sText The string to search in. @param string $sFindText Value to search. @param int $iOffset Default: 0 @return int The position of the first occurrence or -1 if the value to search is not found.
indexOf
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public function lastIndexOf($sText, $sFindText, $iOffset = 0) { $mPosition = strrpos($sText, $sFindText, $iOffset); if (!is_int($mPosition)) { return -1; } return $mPosition; }
Find the position of the last occurrence of a specified value in a string. @param string $sText The string to search in. @param string $sFindText Value to search. @param int $iOffset Default: 0 @return int The position of the last occurrence or -1 if the value to search is not found.
lastIndexOf
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public function trim($sText, $sCharList = " \t\n\r\0\x0B") { return trim($sText, $sCharList); }
Creates a new string by trimming any leading or trailing whitespace from the current string. @param string $sText @param string $sCharList Default: " \t\n\r\0\x0B" @return string
trim
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public function extract($sText, $iLimit = self::DEF_MAX_TEXT_EXTRACT_LENGTH, $sTrimMarker = PH7_ELLIPSIS) { $iStart = 0; if ($this->length($sText) <= $iLimit) { return $sText; } if (function_exists('mb_strimwidth')) { $sText = rtrim( mb_strimwidth( $sText, $iStart, $iLimit, '', PH7_ENCODING ) ); } else { // Recover a portion of the string $sExtract = substr($sText, $iStart, $iLimit); // Find the last space after the last word of the extract if ($iLastSpace = strrpos($sExtract, ' ')) { // Cut the chain to the last space. $sText = substr($sText, $iStart, $iLastSpace); } else { // If the string doesn't contain any spaces, cut the string with the max number of the given characters $sText = substr($sText, $iStart, $iLimit); } } return rtrim($sText) . $sTrimMarker; }
Cut a piece of string to make an extract (an ellipsis). @param string $sText @param int $iLimit Default: 150 @param string $sTrimMarker Default: '...' @return string
extract
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public function get($sText) { return !empty($sText) ? $sText : ''; }
Return the string if the variable is not empty else return empty string. @param string $sText @return string
get
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public static function match($sText, $sPattern) { preg_match_all(self::regexNormalize($sPattern), $sText, $aMatches, PREG_PATTERN_ORDER); if (!empty($aMatches[1])) { return $aMatches[1]; } elseif (!empty($aMatches[0])) { return $aMatches[0]; } return null; }
Perform a regular expression match. @param string $sText The string to search in. @param string $sPattern The RegEx pattern to search for, as a string. @return string|null
match
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public function escape($mText, $bStrip = false) { return is_array($mText) ? $this->arrayEscape($mText, $bStrip) : $this->cEscape($mText, $bStrip); }
Escape function, uses the PHP native htmlspecialchars but improved. @param array|string $mText @param bool $bStrip If TRUE, strip only HTML tags instead of converting them into HTML entities. Less secure. Default: FALSE @return array|string The escaped string.
escape
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
function escape($mText, $bStrip = false) { return (new Str)->escape($mText, $bStrip); }
Alias of Str::escape() method. @param array|string $mText @param bool $bStrip @return array|string
escape
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Str/Str.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Str/Str.class.php
MIT
public static function api($sIp = null) { $sIp = $sIp === null ? static::get() : $sIp; return DbConfig::getSetting('ipApi') . $sIp; }
Returns the API IP with the IP address. @param string|null $sIp IP address. Allows to specify a specific IP. @return string API URL with the IP address.
api
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Ip/Ip.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Ip/Ip.class.php
MIT
public static function isPrivate($sIp) { return filter_var( $sIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ? false : true; }
Check if it's a local machine IP or not. @param string $sIp The IP address. @return bool Returns TRUE is it's a private IP, FALSE otherwite.
isPrivate
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Ip/Ip.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Ip/Ip.class.php
MIT
public static function getStatusCode(int $iStatus) { return !empty(static::STATUS_CODE[$iStatus]) ? static::STATUS_CODE[$iStatus] : false; }
Give the HTTP status code name (e.g. "204 No Content"). @param int $iStatus The "code" for the HTTP status. @return string|bool $iStatus Returns the "HTTP status code" if found, FALSE otherwise.
getStatusCode
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Http/Http.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Http/Http.class.php
MIT
public function __construct() { $this->inputs(); }
Calls Rest::_inputs() method and sets default values.
__construct
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Http/Rest/Rest.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Http/Rest/Rest.class.php
MIT
private function __construct() { }
Private constructor to prevent instantiation of class since it's a static class.
__construct
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Error/Debug.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Error/Debug.class.php
MIT
function errExcept($iCode, $sMessage, $sFile, $sLine) { throw new ErrException($sMessage, 0, $iCode, $sFile, $sLine); }
The code serves as severity Refer to the predefined constants for more information: http://php.net/manual/errorfunc.constants.php @param integer $iCode @param string $sMessage @param string $sFile @param string $sLine @throws ErrException
errExcept
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Error/CException/ErrException.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Error/CException/ErrException.class.php
MIT
public static function launch(Exception $oExcept) { if (Debug::is()) { Page::exception($oExcept); } else { (new LoggerExcept)->except($oExcept); // Set Exception in Error Log Page::error500(); } }
Sends the exception data to the logger class. @param Exception $oExcept
launch
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Error/CException/PH7Exception.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Error/CException/PH7Exception.class.php
MIT
public function getTimeOfCacheFile() { return $this->oFile->getModifTime($this->getFile()); }
Get the creation/modification time of the current cache file. @return int|bool Time the file was last modified/created as a Unix timestamp, or FALSE on failure.
getTimeOfCacheFile
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Cache/Cache.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Cache/Cache.class.php
MIT
public static function getVar($sKey = null, $sDefVal = null) { if (null === $sKey) { return $_SERVER; } return !empty($_SERVER[$sKey]) ? htmlspecialchars((string)$_SERVER[$sKey], ENT_QUOTES) : $sDefVal; }
Retrieve a member of the $_SERVER super global. @param string|null $sKey If NULL, returns the entire $_SERVER variable. @param string|null $sDefVal A default value to use if server key is not found. @return string|array|null
getVar
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Server/Server.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Server/Server.class.php
MIT
public function watermarkText($sText, $iSize) { $iWidthText = $this->iWidth - imagefontwidth($iSize) * mb_strlen($sText) - 3; $iHeightText = $this->iHeight - imagefontheight($iSize) - 3; $rWhite = imagecolorallocate($this->rImage, 255, 255, 255); $rBlack = imagecolorallocate($this->rImage, 0, 0, 0); $rGray = imagecolorallocate($this->rImage, 127, 127, 127); if ($iWidthText > 0 && $iHeightText > 0) { if (imagecolorat($this->rImage, $iWidthText, $iHeightText) > $rGray) { $rColor = $rBlack; } if (imagecolorat($this->rImage, $iWidthText, $iHeightText) < $rGray) { $rColor = $rWhite; } } else { $rColor = $rWhite; } imagestring($this->rImage, $iSize, $iWidthText - 1, $iHeightText - 1, $sText, $rWhite - $rColor); imagestring($this->rImage, $iSize, $iWidthText + 1, $iHeightText + 1, $sText, $rWhite - $rColor); imagestring($this->rImage, $iSize, $iWidthText - 1, $iHeightText + 1, $sText, $rWhite - $rColor); imagestring($this->rImage, $iSize, $iWidthText + 1, $iHeightText - 1, $sText, $rWhite - $rColor); imagestring($this->rImage, $iSize, $iWidthText - 1, $iHeightText, $sText, $rWhite - $rColor); imagestring($this->rImage, $iSize, $iWidthText + 1, $iHeightText, $sText, $rWhite - $rColor); imagestring($this->rImage, $iSize, $iWidthText, $iHeightText - 1, $sText, $rWhite - $rColor); imagestring($this->rImage, $iSize, $iWidthText, $iHeightText + 1, $sText, $rWhite - $rColor); imagestring($this->rImage, $iSize, $iWidthText, $iHeightText, $sText, $rColor); return $this; }
Create a Watermark text on the image. @param string $sText Text of watermark. @param int $iSize The size of text. Between 0 to 5. @return self
watermarkText
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Image/FileStorage.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Image/FileStorage.class.php
MIT
public function getType() { return exif_imagetype($this->sFile); }
Determine and get the type of the image (even an unallowed image type) by reading the first bytes and checking its signature. @return int|bool When a correct signature is found, returns the appropriate integer constant value, FALSE otherwise.
getType
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Image/FileStorage.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Image/FileStorage.class.php
MIT
private function allocateAlphaColorTransparency() { $iAlphaColor = imagecolorallocatealpha($this->rImage, 0, 0, 0, 127); imagefill($this->rImage, 0, 0, $iAlphaColor); }
Create a new transparent alpha color.
allocateAlphaColorTransparency
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Image/FileStorage.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Image/FileStorage.class.php
MIT
public function setMaxPages($maxPages) { $this->maxPages = 1; if ($maxPages > 0) { $this->maxPages = $maxPages; } }
Set the max number of pages of google to parse @param int $maxPages the max number of pages @return void
setMaxPages
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Seo/GoogleKeywordsRankAPI.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Seo/GoogleKeywordsRankAPI.class.php
MIT
public function getMaxPages() { return $this->maxPages; }
Get the max number of pages of google to parse @return int maxPages
getMaxPages
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Seo/GoogleKeywordsRankAPI.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Seo/GoogleKeywordsRankAPI.class.php
MIT
public static function pH7FwkClass($sClassName, $sNameSpace = null, $sExt = 'php') { $sClassName = static::getSlashPath($sClassName); return static::load(PH7_PATH_FRAMEWORK . $sClassName . '.class', $sExt, $sNameSpace); }
Import only Class or Interface of the "pH7Framework" (without dot). @param string $sClassName Class path. @param string $sNameSpace Namespace. @param string $sExt Optional, the file extension without the dot. @return mixed (resource, string, boolean, void, ...) @throws IOException
pH7FwkClass
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Import.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Import.class.php
MIT
public static function pH7App($sClassName, $sNameSpace = null, $sExt = 'php') { $sClassName = static::getSlashPath($sClassName); return static::load(PH7_PATH_APP . $sClassName, $sExt, $sNameSpace); }
Import only Class or Interface in the "app" directory (without dot). @param string $sClassName Class path. @param string $sNameSpace Namespace. @param string $sExt Optional, the file extension without the dot. @return mixed (resource, string, boolean, void, ...) @throws IOException
pH7App
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Import.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Import.class.php
MIT
public static function lib($sFile, $sNameSpace = null, $sExt = 'php') { $sFile = static::getSlashPath($sFile); return static::load(PH7_PATH_LIBRARY . $sFile, $sExt, $sNameSpace); }
Import File of the Library (without dot). @param string $sFile File path. @param string $sNameSpace Namespace. @param string $sExt Optional, the file extension without the dot. @return mixed (resource, string, boolean, void, ...) @throws IOException
lib
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Import.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Import.class.php
MIT
public static function bytesToSize($iBytes, $iPrecision = 2) { $aUnits = ['byte', 'kilobyte', 'megabyte', 'gigabyte', 'terabyte']; $iBytes = max($iBytes, 0); $iPow = floor(($iBytes ? log($iBytes) : 0) / log(1024)); $iPow = min($iPow, count($aUnits) - 1); $iBytes /= (1 << (10 * $iPow)); return t($aUnits[$iPow], round($iBytes, $iPrecision)); }
Convert bytes to human readable format. @param int $iBytes The size in bytes. @param int $iPrecision Default 2 @return string The size.
bytesToSize
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Various.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Various.class.php
MIT
public static function sizeToBytes($sSize) { $cSuffix = strtolower(substr(trim($sSize), -1)); $iSize = (int)$sSize; switch ($cSuffix) { // kilobyte case 'k': $iSize *= 1024; break; // megabyte case 'm': $iSize *= 1024 * 1024; break; // gigabyte case 'g': $iSize *= 1024 * 1024 * 1024; break; default: throw new PH7InvalidArgumentException( sprintf('Wrong suffix: %s! Choose between: K, M, G', $cSuffix) ); } return $iSize; }
Convert the string size to bytes. @param string The size (e.g.,10K, 10M, 10G). @return int The integer bytes. @throws PH7InvalidArgumentException Explanatory message.
sizeToBytes
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Various.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Various.class.php
MIT
public function checkExtDir($sDir, $bStart = false, $bEnd = true) { $bIsWindows = Server::isWindows(); if (!$bIsWindows && $bStart === true && substr($sDir, 0, 1) !== PH7_DS) { $sDir = PH7_DS . $sDir; } if ($bEnd === true && substr($sDir, -1) !== PH7_DS) { $sDir .= PH7_DS; } return $sDir; }
Make sure that folder names have a trailing. @param string $sDir The directory. @param bool $bStart for check extension directory start. Default FALSE @param bool $bEnd for check extension end. Default TRUE @return string $sDir Directory
checkExtDir
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function copy($sFrom, $sTo) { if (!is_file($sFrom)) { return false; } return @copy($sFrom, $sTo); }
Copy files and checks if the "from file" exists. @param string $sFrom File. @param string $sTo File. @return bool
copy
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function copyDir($sFrom, $sTo) { return $this->recursiveDirIterator($sFrom, $sTo, self::COPY_FUNC_NAME); }
Copy the contents of a directory into another. @param string $sFrom Old directory. @param string $sTo New directory. @return bool TRUE if everything went well, otherwise FALSE if the "from directory" couldn't be found or if it couldn't be copied. @throws PH7InvalidArgumentException
copyDir
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function systemCopy($sFrom, $sTo) { if (file_exists($this->removeWildcards($sFrom))) { return system("cp -r $sFrom $sTo"); } return false; }
Copy a file or directory with the Unix cp command. @param string $sFrom File or directory. @param string $sTo File or directory. @return int|bool Returns the last line on success, and FALSE on failure.
systemCopy
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function rename($sFrom, $sTo) { if (!file_exists($sFrom)) { return false; } return @rename($sFrom, $sTo); }
Rename a file or directory and checks if the "from file" or directory exists with file_exists() function since it checks the existence of a file or directory (because, as in the Unix OS, a directory is a file). @param string $sFrom File or directory. @param string $sTo File or directory. @return bool
rename
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function renameDir($sFrom, $sTo) { return $this->recursiveDirIterator($sFrom, $sTo, self::RENAME_FUNC_NAME); }
Rename the contents of a directory into another. @param string $sFrom Old directory. @param string $sTo New directory. @return bool TRUE if everything went well, otherwise FALSE if the "from directory" couldn't be found or if it couldn't be renamed. @throws PH7InvalidArgumentException
renameDir
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function systemRename($sFrom, $sTo) { if (file_exists($this->removeWildcards($sFrom))) { return system("mv $sFrom $sTo"); } return false; }
Rename a file or directory with the Unix mv command. @param string $sFrom File or directory. @param string $sTo File or directory. @return int|bool Returns the last line on success, and FALSE on failure.
systemRename
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function getModifTime($sFile) { return is_file($sFile) ? filemtime($sFile) : false; }
Get the creation/modification time of a file in the Unix timestamp. @param string $sFile Full path of the file. @return int|bool Returns the time the file was last modified, or FALSE if it not found.
getModifTime
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public static function version($sFile) { return @filemtime($sFile); }
Get the version of a file based on the its latest modification. Shortened form of self::getModifTime() @param string $sFile Full path of the file. @return int Returns the latest modification time of the file in Unix timestamp.
version
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function chmod($sFile, $iMode) { // file_exists function verify the existence of a "file" or "folder"! if (file_exists($sFile) && $this->getOctalAccess($sFile) !== $iMode) { return @chmod($sFile, $iMode); } return false; }
Changes permission on a file or directory. @param string $sFile @param int $iMode Octal Permission for the file. @return bool
chmod
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function getDirFreeSpace($sPath) { return disk_free_space($sPath); }
Get free space of a directory. @param string $sPath @return float The number of available bytes as a float.
getDirFreeSpace
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function save($sFile, $sData) { $sTmpFile = $this->getFileWithoutExt($sFile) . '.tmp.' . $this->getFileExt($sFile); $iWritten = (new SplFileObject($sTmpFile, 'wb'))->fwrite($sData); if ($iWritten !== null) { // Copy of the temporary file to the original file if no problem occurred. copy($sTmpFile, $sFile); } // Deletes the temporary file. $this->deleteFile($sTmpFile); return $iWritten; }
Writes and saves the contents to a file. It also creates a temporary file to not delete the original file if something goes wrong during the recording file. @param string $sFile @param string $sData @return int Returns the number of bytes written, or NULL on error.
save
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function getUrlContents(string $sUrl) { $rCh = curl_init(); curl_setopt($rCh, CURLOPT_URL, $sUrl); curl_setopt($rCh, CURLOPT_HEADER, 0); curl_setopt($rCh, CURLOPT_RETURNTRANSFER, 1); curl_setopt($rCh, CURLOPT_FOLLOWLOCATION, 1); $mRes = curl_exec($rCh); if ($mRes === false) { throw new CurlException(curl_error($rCh), curl_errno($rCh)); } curl_close($rCh); unset($rCh); return $mRes; }
Get the URL contents (For URLs, it is better to use CURL because it is faster than file_get_contents function). @param string $sUrl URL to be read contents. @return string|bool Return the result content on success, FALSE on failure.
getUrlContents
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/File.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/File.class.php
MIT
public function get($sFrom, $sTo) { $iType = $this->getFileMode($sTo); if (!@ftp_get($this->rStream, $sFrom, $sTo, $iType)) { throw new UploadingFileException('There was a problem while uploading from: ' . $sFrom); } }
Downloads a file from the FTP server. @param string $sFrom Full path to the file on the server. @param string $sTo Full path where the file will be placed on the computer. @return void @throws UploadingFileException If the file cannot be transferred to the computer.
get
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Transfer/Ftp.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Transfer/Ftp.class.php
MIT
public function put($sFrom, $sTo, $iMode = Chmod::MODE_WRITE_READ) { $iType = $this->getFileMode($sTo); if (@ftp_put($this->rStream, $sTo, $sFrom, $iType)) { $this->chmod($sTo, $iMode); // For Unix OS } else { throw new UploadingFileException('There was a problem while uploading from: ' . $sFrom); } }
Uploads a file to the FTP server. @param string $sFrom Full path to the file on the computer. @param string $sTo Full path where the file will be placed on the server. @param int (octal) $iMode @return void @throws UploadingFileException If the file cannot be transferred to the server.
put
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Transfer/Ftp.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Transfer/Ftp.class.php
MIT
public function rename($sFrom, $sTo) { if (!$this->existFile($sFrom)) { return false; } return ftp_rename($this->rStream, $sFrom, $sTo); }
Rename or move a file from one location to another on the FTP server. @param string $sFrom Full path to the file. @param string $sTo Full path to the file. @return bool Returns TRUE on success or FALSE on failure.
rename
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Transfer/Ftp.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Transfer/Ftp.class.php
MIT
public function deleteFile($mFile) { if (is_array($mFile)) { $bRet = false; foreach ($mFile as $sFile) { if (!$bRet = $this->deleteFile($sFile)) { return false; } } return $bRet; } else { if ($this->existFile($mFile)) { return ftp_delete($this->rStream, $mFile); } } }
Deletes a file or files if they are in an array. If the file does not exist, the function does nothing. @param string|array $mFile @return bool
deleteFile
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Transfer/Ftp.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Transfer/Ftp.class.php
MIT
public function deleteDir($sPath) { return $this->existFile($sPath) ? $this->deleteFile($sPath) : array_map([$this, 'deleteDir'], glob($sPath . '/*')) === @ftp_rmdir($this->rStream, $sPath); }
Delete directories recursively. @param string $sPath The path @return bool
deleteDir
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Transfer/Ftp.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Transfer/Ftp.class.php
MIT
public function alloc($sFile) { return !ftp_alloc($this->rStream, $this->size($sFile), $sRes) ? $sRes : true; }
Allocates space for a file to be uploaded. @param string $sFile @return bool|string Returns TRUE on success or a message from the server in case of failure.
alloc
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Transfer/Ftp.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Transfer/Ftp.class.php
MIT
public function getSize($sFile) { return ftp_size($this->rStream, $sFile); }
Retrieve the size of a file from the FTP server. @param string $sFile @return int Returns the file size on success, or -1 on error.
getSize
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Transfer/Ftp.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Transfer/Ftp.class.php
MIT
public function getCurrentDir() { return ftp_pwd($this->rStream); }
Get the current directory name. @return string Current directory name.
getCurrentDir
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Transfer/Ftp.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Transfer/Ftp.class.php
MIT
public function changeDir($sDir) { return ftp_chdir($this->rStream, $sDir); }
Changes the current directory. @param string $sDir @return bool Returns TRUE on success or FALSE on failure. If changing directory fails, PHP will also throw a warning.
changeDir
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Transfer/Ftp.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Transfer/Ftp.class.php
MIT
public function exec($sCommand) { return ftp_exec($this->rStream, $sCommand); }
Requests execution of a command on the FTP server. @param string $sCommand @return bool Returns TRUE if the command was successful (server sent response code: 200); otherwise returns FALSE.
exec
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/File/Transfer/Ftp.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/File/Transfer/Ftp.class.php
MIT
private function __construct() { $this->sUri = (new HttpRequest)->requestUri(); // Strip the trailing slash from the URL to avoid taking a wrong URL fragment $this->sUri = rtrim($this->sUri, PH7_SH); /*** Here, we put the string into array ***/ self::$aFragments = explode(PH7_SH, $this->sUri); }
Construct the query string URI.
__construct
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Url/Uri.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Url/Uri.class.php
MIT
public static function redirect($sUrl = null, $sMessage = null, $sType = Design::SUCCESS_TYPE, int $iRedirectCode = StatusCode::MOVED_PERMANENTLY) { Http::setHeadersByCode($iRedirectCode); $oHttpRequest = new HttpRequest; $sUrl = $sUrl !== null ? $sUrl : $oHttpRequest->currentUrl(); $sUrl = $oHttpRequest->pH7Url($sUrl); unset($oHttpRequest); if ($sMessage !== null) { (new Design)->setFlashMsg($sMessage, $sType); } header('Location: ' . $sUrl); exit; }
Allows a redirection URL respecting the HTTP status code for search engines friendly. @param string $sUrl Default NULL, so it's the current URL. @param string $sMessage Default NULL, so no message. @param string $sType Type of message: "Design::SUCCESS_TYPE", "Design::INFO_TYPE", "Design::WARNING_TYPE" or "Design::ERROR_TYPE" @param int $iRedirectCode Optional. Default MOVED_PERMANENTLY 301 @return void
redirect
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Url/Header.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Url/Header.class.php
MIT
public function setSortByMetrics($sort) { if ($sort == true) { $this->sort = ""; } else { $this->sort = "-"; } $this->sortParam = 'metrics'; }
Set the result's sort by metrics @param boolean $sort asc or desc sort @return void
setSortByMetrics
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Analytics/GoogleAnalyticsAPI.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Analytics/GoogleAnalyticsAPI.class.php
MIT
public function setSortByDimensions($sort) { if ($sort == true) { $this->sort = ""; } else { $this->sort = "-"; } $this->sortParam = 'dimensions'; }
Set the result's sort by dimensions @param boolean $sort asc or desc sort @return void
setSortByDimensions
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Analytics/GoogleAnalyticsAPI.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Analytics/GoogleAnalyticsAPI.class.php
MIT
public function setStartIndex($startIndex) { $this->startIndex = $startIndex; }
Set the start index of the results to display @param int $startIndex the start index of the results to display @return void
setStartIndex
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Analytics/GoogleAnalyticsAPI.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Analytics/GoogleAnalyticsAPI.class.php
MIT
public function setFilter($filter) { $this->filter = $filter; }
Set the filters query string parameter restricts the data returned from your request to the Analytics servers @param int $filter the filters query string parameter restricts the data returned from your request to the Analytics servers @return void
setFilter
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Analytics/GoogleAnalyticsAPI.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Analytics/GoogleAnalyticsAPI.class.php
MIT
public function getMetric($metrics, $filters = null) { $url = 'https://www.google.com/analytics/feeds/data?ids=ga:' . $this->ids; $url .= '&metrics=ga:' . $metrics; if ($filters !== null) { $url .= '&filters=ga:' . $filters; } $url .= '&start-date=' . $this->dateBegin; $url .= '&end-date=' . $this->dateEnd; if ($this->maxResults > 0) { $url .= '&max-results=' . $this->maxResults; } if ($this->startIndex > 0) { $url .= '&start-index=' . $this->startIndex; } if ($this->getContent($url) == 200) { $XML_object = simplexml_load_string($this->response); $dxp = $XML_object->entry->children('http://schemas.google.com/analytics/2009'); if (@count($dxp) > 0) { $metric_att = $dxp->metric->attributes(); } return $metric_att['value'] ? (string)$metric_att['value'] : 0; } else { return null; } }
Get the google analytics datas by metrics See : http://code.google.com/intl/fr/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html For all the parameters : http://code.google.com/intl/fr-FR/apis/analytics/docs/gdata/gdataReferenceDataFeed.html @param string $metrics the metrics @param string $uri the url of the website page (ex : /myurl/) @return array
getMetric
php
pH7Software/pH7-Social-Dating-CMS
_protected/framework/Analytics/GoogleAnalyticsAPI.class.php
https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Analytics/GoogleAnalyticsAPI.class.php
MIT