本文整理汇总了PHP中General类的典型用法代码示例。如果您正苦于以下问题:PHP General类的具体用法?PHP General怎么用?PHP General使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了General类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ProductUpdateCart
function ProductUpdateCart($argProductID, $argQty)
{
$objCore = new Core();
$objGeneral = new General();
$arrCartDetails = array();
$arrNewCart = array();
if (isset($_SESSION['sessCartDetails'])) {
$arrCartDetails = $_SESSION['sessCartDetails'];
}
foreach ($arrCartDetails as $arrTempCartData) {
$varPrdId = $arrTempCartData['ProductId'];
if ($varPrdId == $argProductID) {
$arrTempCartData['Qty'] = $argQty;
//getting details
$arrCol = array('pkProductID', 'ProductName', 'ProductCode', 'ProductDescription', 'ProductSpecifications', 'ProductWeight', 'ProductCost', 'ProductActualCost', 'ProductQuantity', 'ProductQuantityAvailable', 'ProductStatus', 'ProductIsFeatured', 'ProductImage', 'ProductIsSpecailOffer', 'ProductDateAdded', 'ProductDateModified');
$varWhr = 'pkProductID=' . $argProductID;
$arrProduct = $objGeneral->getRecord(TABLE_PRODUCTS, $arrCol, $varWhr);
}
array_push($arrNewCart, $arrTempCartData);
}
if ($_SESSION['sessMess']) {
$_SESSION['sessVarMsg'] = '';
$_SESSION['sessVarMsg'] = 'Cart details have been updated successfully .';
$_SESSION['sessFlag'] = false;
$objCore->setSuccessMsg($_SESSION['sessVarMsg']);
}
unset($_SESSION['sessCartDetails']);
$_SESSION['sessCartDetails'] = $arrNewCart;
}
示例2: forgotPasswordMail
function forgotPasswordMail($argArrPOST)
{
$objTemplate = new EmailTemplate();
$objValid = new Validate_fields();
$objCore = new Core();
$objGeneral = new General();
$objValid->check_4html = true;
$_SESSION['sessForgotValues'] = array();
$objValid->add_text_field('Login ID', strip_tags($argArrPOST['frmUserName']), 'text', 'y', 255);
$objValid->add_text_field('Verification Code', strip_tags($argArrPOST['frmSecurityCode']), 'text', 'y', 255);
if (!$objValid->validation()) {
$errorMsg = $objValid->create_msg();
}
if ($errorMsg) {
$_SESSION['sessForgotValues'] = $argArrPOST;
$objCore->setErrorMsg($errorMsg);
return false;
} else {
if ($_SESSION['security_code'] == $argArrPOST['frmSecurityCode'] && !empty($_SESSION['security_code'])) {
$varWhereCond = " AND ClientEmailAddress ='" . $argArrPOST['frmUserName'] . "'";
$userRecords = $this->getClientNumRows($varWhereCond);
$userInfo = $this->getClientInfo($varWhereCond);
if ($userRecords > 0) {
$varClientID = $userInfo['0']['pkClientID'];
$varMemberData = trim(strip_tags($argArrPOST['frmUserName']));
$varForgotPasswordCode = $objGeneral->getValidRandomKey(TABLE_CLIENTS, array('pkClientID'), 'ClientForgotPWCode', '25');
$varForgotPasswordLink = '<a href="' . SITE_ROOT_URL . 'clients/reset_password.php?mid=' . $varClientID . '&code=' . $varForgotPasswordCode . '">' . SITE_ROOT_URL . 'clients/reset_password.php?mid=' . $varClientID . '&code=' . $varForgotPasswordCode . '</a>';
$arrColumns = array('ClientForgotPWStatus' => 'Active', 'ClientForgotPWCode' => $varForgotPasswordCode);
$varWhereCondition = 'pkClientID = \'' . $varClientID . '\'';
$this->update(TABLE_CLIENTS, $arrColumns, $varWhereCondition);
$varClientEmail = $userInfo[0]['ClientEmailAddress'];
$varToUser = $varClientEmail;
$varFromUser = SITE_NAME . '<' . $varClientEmail . '>';
$varSiteName = SITE_NAME;
$varWhereTemplate = ' EmailTemplateTitle= \'Forgot password\' AND EmailTemplateStatus = \'Active\' ';
$arrMailTemplate = $objTemplate->getTemplateInfo($varWhereTemplate);
$varOutput = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateDescription']));
$varSubject = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateSubject']));
$varSubject = str_replace('{PROJECT_NAME}', SITE_NAME, html_entity_decode(stripcslashes($arrMailTemplate['0']['EmailTemplateSubject'])));
$varKeyword = array('{IMAGE_PATH}', '{MEMBER}', '{PROJECT_NAME}', '{USER_DATA}', '{FORGOT_PWD_LINK}', '{SITE_NAME}');
$varKeywordValues = array($varPathImage, 'Client', SITE_NAME, $varMemberData, $varForgotPasswordLink, SITE_NAME);
$varOutPutValues = str_replace($varKeyword, $varKeywordValues, $varOutput);
$objCore->sendMail($varToUser, $varFromUser, $varSubject, $varOutPutValues);
$_SESSION['sessForgotValues'] = '';
$objCore->setSuccessMsg(ADMIN_FORGOT_PASSWORD_CONFIRM_MSG);
return true;
} else {
$_SESSION['sessForgotValues'] = $argArrPOST;
$objCore->setErrorMsg(EMAIL_NOT_EXIST_MSG);
return true;
}
} else {
$_SESSION['sessForgotValues'] = $argArrPOST;
$objCore->setErrorMsg(INVALID_SECURITY_CODE_MSG);
return false;
}
}
}
示例3: render
public static function render($e)
{
if (is_null($e->getTemplatePath())) {
header('HTTP/1.0 500 Server Error');
echo '<h1>Symphony Fatal Error</h1><p>' . $e->getMessage() . '</p>';
exit;
}
$xml = new DOMDocument('1.0', 'utf-8');
$xml->formatOutput = true;
$root = $xml->createElement('data');
$xml->appendChild($root);
$root->appendChild($xml->createElement('heading', General::sanitize($e->getHeading())));
$root->appendChild($xml->createElement('message', General::sanitize($e->getMessageObject() instanceof SymphonyDOMElement ? (string) $e->getMessageObject() : trim($e->getMessage()))));
if (!is_null($e->getDescription())) {
$root->appendChild($xml->createElement('description', General::sanitize($e->getDescription())));
}
header('HTTP/1.0 500 Server Error');
header('Content-Type: text/html; charset=UTF-8');
header('Symphony-Error-Type: ' . $e->getErrorType());
foreach ($e->getHeaders() as $header) {
header($header);
}
$output = parent::__transform($xml, basename($e->getTemplatePath()));
header(sprintf('Content-Length: %d', strlen($output)));
echo $output;
exit;
}
示例4: createNewSession
/**
* Creates a new Session-object, if password is correct
*/
static function createNewSession($password, $project_id = null)
{
if (!$project_id) {
$project_id = Config::$default_project_id;
}
// Delete old Session object from php_session cache
// and create new session_id to prevent session fixation:
self::destroySession();
$session = self::getInstance();
if ($password) {
// some password has to be entered
//Allow login via Master Password
if (Config::$allow_project_login_with_master_password && General::CheckPostMasterPassword($password)) {
$password = '';
}
try {
$session->project = new Project($project_id, $password);
} catch (PasswordException $e) {
$session->project = null;
}
} else {
$session->project = null;
}
return $session;
}
示例5: install
public function install()
{
Symphony::Configuration()->set('lang', 'en', 'redactor');
Symphony::Configuration()->set('direction_ltr', 'yes', 'redactor');
Symphony::Configuration()->set('enable_toolbar', 'yes', 'redactor');
Symphony::Configuration()->set('enable_source', 'yes', 'redactor');
Symphony::Configuration()->set('enable_focus', 'no', 'redactor');
Symphony::Configuration()->set('enable_shortcuts', 'yes', 'redactor');
Symphony::Configuration()->set('enable_autoresizing', 'yes', 'redactor');
Symphony::Configuration()->set('enable_cleanup', 'yes', 'redactor');
Symphony::Configuration()->set('enable_fixed', 'no', 'redactor');
Symphony::Configuration()->set('enable_fixedbox', 'no', 'redactor');
Symphony::Configuration()->set('enable_paragraphy', 'yes', 'redactor');
Symphony::Configuration()->set('enable_convertlinks', 'yes', 'redactor');
Symphony::Configuration()->set('enable_convertdivs', 'yes', 'redactor');
Symphony::Configuration()->set('enable_fileupload', 'no', 'redactor');
Symphony::Configuration()->set('enable_imageupload', 'yes', 'redactor');
Symphony::Configuration()->set('enable_overlay', 'yes', 'redactor');
Symphony::Configuration()->set('enable_observeimages', 'yes', 'redactor');
Symphony::Configuration()->set('enable_airmode', 'no', 'redactor');
Symphony::Configuration()->set('enable_wym', 'no', 'redactor');
Symphony::Configuration()->set('enable_mobile', 'yes', 'redactor');
Symphony::Configuration()->set('buttons', implode($this->buttons, ','), 'redactor');
Symphony::Configuration()->set('airbuttons', implode($this->airbuttons, ','), 'redactor');
Symphony::Configuration()->set('allowedtags', implode($this->allowedtags, ','), 'redactor');
Symphony::Configuration()->set('filepath', WORKSPACE . '/redactor/files', 'redactor');
Symphony::Configuration()->set('imagepath', WORKSPACE . '/redactor/images', 'redactor');
Symphony::Configuration()->write();
return General::realiseDirectory(Symphony::Configuration()->get('filepath', 'redactor')) && General::realiseDirectory(Symphony::Configuration()->get('imagepath', 'redactor'));
}
示例6: __viewIndex
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle('Symphony – Importers');
$tableHead = array(array('Name', 'col'), array('Version', 'col'), array('Author', 'col'));
$tableBody = array();
if (!is_array($this->_importers) or empty($this->_importers)) {
$tableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', null, count($tableHead)))));
} else {
foreach ($this->_importers as $importer) {
$importer = (object) $importer;
$col_name = Widget::TableData(Widget::Anchor($this->_driver->truncateValue($importer->name), $this->_uri . "/importers/edit/{$importer->handle}/"));
$col_name->appendChild(Widget::Input("items[{$importer->id}]", null, 'checkbox'));
$col_version = Widget::TableData($this->_driver->truncateValue($importer->version));
$col_author = Widget::TableData($this->_driver->truncateValue($importer->version));
if (isset($importer->author['website']) and preg_match('/^[^\\s:\\/?#]+:(?:\\/{2,3})?[^\\s.\\/?#]+(?:\\.[^\\s.\\/?#]+)*(?:\\/[^\\s?#]*\\??[^\\s?#]*(#[^\\s#]*)?)?$/', $importer->author['website'])) {
$col_author = Widget::Anchor($importer->author['name'], General::validateURL($importer->author['website']));
} elseif (isset($importer->author['email']) and preg_match('/^\\w(?:\\.?[\\w%+-]+)*@\\w(?:[\\w-]*\\.)+?[a-z]{2,}$/i', $importer->author['email'])) {
$col_author = Widget::Anchor($importer->author['name'], 'mailto:' . $importer->author['email']);
} else {
$col_author = $importer->author['name'];
}
$col_author = Widget::TableData($col_author);
$tableBody[] = Widget::TableRow(array($col_name, $col_version, $col_author));
}
}
$table = Widget::Table(Widget::TableHead($tableHead), null, Widget::TableBody($tableBody));
$this->Form->appendChild($table);
}
示例7: view
public function view()
{
$params = array();
$filter = $_GET['query'];
if ($_GET['template']) {
$this->template = General::sanitize($_GET['template']);
}
// Environment parameters
if ($filter == 'env') {
$params = array_merge($params, $this->__getEnvParams());
// Page parameters
} elseif ($filter == 'page') {
$params = array_merge($params, $this->__getPageParams());
// Data source parameters
} elseif ($filter == 'ds') {
$params = array_merge($params, $this->__getDSParams());
// All parameters
} else {
$params = array_merge($params, $this->__getEnvParams());
$params = array_merge($params, $this->__getPageParams());
$params = array_merge($params, $this->__getDSParams());
}
foreach ($params as $param) {
if (empty($filter) || strripos($param, $filter) !== false) {
$this->_Result[] = $param;
}
}
sort($this->_Result);
}
示例8: write_file
function write_file($filename, $text, $db_escape = false)
{
$text = General::input_clean($text);
$filename = RheinaufFile::get_enc($filename);
if (!is_file($filename) && defined('USE_FTP') && USE_FTP === true) {
$filename = str_replace(docroot(), '', $filename);
$root_dir = FTP_ROOTDIR;
$tmpname = TMPDIR . '/' . uniqid('RheinaufCMS_tmp_' . basename($filename));
$file = fopen($tmpname, "wb");
$fwrite = fwrite($file, $text);
fclose($file);
$ftp_filename = $root_dir . $filename;
RheinaufFile::ftpcmd("ftp_put(\$conn_id,'{$ftp_filename}','{$tmpname}',FTP_BINARY);");
RheinaufFile::chmod($filename, 777);
RheinaufFile::delete($tmpname);
} else {
if (is_file($filename) && !is_writable($filename)) {
RheinaufFile::chmod($filename, '0777');
}
$file = fopen($filename, "wb");
$fwrite = fwrite($file, $text);
fclose($file);
if (is_file($filename)) {
RheinaufFile::chmod($filename, 777);
}
return $fwrite;
}
}
示例9: listAll
function listAll()
{
$result = array();
$people = array();
$structure = General::listStructure(TEXTFORMATTERS, '/formatter.[\\w-]+.php/', false, 'ASC', TEXTFORMATTERS);
if (is_array($structure['filelist']) && !empty($structure['filelist'])) {
foreach ($structure['filelist'] as $f) {
$f = str_replace(array('formatter.', '.php'), '', $f);
$result[$f] = $this->about($f);
}
}
$extensionManager = new ExtensionManager($this->_Parent);
$extensions = $extensionManager->listInstalledHandles();
if (is_array($extensions) && !empty($extensions)) {
foreach ($extensions as $e) {
if (!is_dir(EXTENSIONS . "/{$e}/text-formatters")) {
continue;
}
$tmp = General::listStructure(EXTENSIONS . "/{$e}/text-formatters", '/formatter.[\\w-]+.php/', false, 'ASC', EXTENSIONS . "/{$e}/text-formatters");
if (is_array($tmp['filelist']) && !empty($tmp['filelist'])) {
foreach ($tmp['filelist'] as $f) {
$f = preg_replace(array('/^formatter./i', '/.php$/i'), '', $f);
$result[$f] = $this->about($f);
}
}
}
}
ksort($result);
return $result;
}
示例10: __buildPageXML
public function __buildPageXML($page, $page_types, $qf)
{
$lang_code = FLang::getLangCode();
$oPage = new XMLElement('page');
$oPage->setAttribute('handle', $page['handle']);
$oPage->setAttribute('id', $page['id']);
// keep current first
$oPage->appendChild(new XMLElement('item', General::sanitize($page['plh_t-' . $lang_code]), array('lang' => $lang_code, 'handle' => $page['plh_h-' . $lang_code])));
// add others
foreach (FLang::getLangs() as $lc) {
if ($lang_code != $lc) {
$oPage->appendChild(new XMLElement('item', General::sanitize($page['plh_t-' . $lc]), array('lang' => $lc, 'handle' => $page['plh_h-' . $lc])));
}
}
if (in_array($page['id'], array_keys($page_types))) {
$xTypes = new XMLElement('types');
foreach ($page_types[$page['id']] as $type) {
$xTypes->appendChild(new XMLElement('type', $type));
}
$oPage->appendChild($xTypes);
}
if ($page['children'] != '0') {
if ($children = PageManager::fetch(false, array($qf . 'id, handle, title'), array(sprintf('`parent` = %d', $page['id'])))) {
foreach ($children as $c) {
$oPage->appendChild($this->__buildPageXML($c, $page_types, $qf));
}
}
}
return $oPage;
}
示例11: appendFormattedElement
public function appendFormattedElement(&$wrapper, $data, $encode = false, $mode = NULL, $entry_id = NULL)
{
if (is_null($data) || !is_array($data) || is_null($data['value'])) {
return;
}
$wrapper->appendChild(new XMLElement($this->get('element_name'), $encode ? General::sanitize($data['value']) : $data['value'], array('handle' => $data['handle'])));
}
示例12: store
public function store()
{
if (Input::has('btnThem')) {
$nhomquyen = Input::get('quyen');
$mst = str_replace(" ", "", Input::get('txtMaSoThe'));
$pass = Hash::make(General::randomPassword());
$hoten = str_replace(" ", " ", trim(Input::get('txtHoTen')));
$gioitinh = Input::get('gioiTinh');
$ngaysinh = Input::get('txtNgaySinh');
$email = str_replace(" ", "", Input::get('txtEmail'));
$ngaycapthe = Input::get('txtNgayCapThe');
$ngayhethan = null;
if (Input::get('txtNgayHetHan') != "") {
$ngayhethan = Input::get('txtNgayHetHan');
}
$tthoatdong = 0;
if (Input::get('checkHoatDong') == "hoatdong") {
$tthoatdong = 1;
} else {
$tthoatdong = 0;
}
$result = DB::table('nguoi_dung')->insert(array('id_nhom_quyen_han' => $nhomquyen, 'ma_so_the' => $mst, 'password' => $pass, 'ho_ten' => $hoten, 'gioi_tinh' => $gioitinh, 'ngay_sinh' => $ngaysinh, 'email' => $email, 'ngay_cap_the' => $ngaycapthe, 'ngay_het_han' => $ngayhethan, 'trang_thai_hoat_dong' => $tthoatdong));
General::storeevents(QUAN_LY_THEM_NGUOI_DUNG . " có mã số thẻ " . $mst);
return Redirect::back()->with('message', 'Thêm người dùng thành công!');
}
}
示例13: transform
public function transform($data)
{
if (!General::validateXML($data, $errors, false, new XsltProcess())) {
throw new TransformException('Data returned is invalid.', $errors);
}
return $data;
}
示例14: loadDrivers
/**
*
* Utility function that loads all the drivers
* in the drivers directory
* @throws ServiceDriverException
*/
private static final function loadDrivers()
{
// if the pointer is null, then we sould load the drivers
if (self::$drivers == null) {
// create a new array
self::$drivers = array();
// get all files in the drivers folders
$drivers = General::listStructure(OEMBED_DRIVERS_DIR, '/class.service[a-zA-Z0-9]+.php/', false, 'asc');
// for each file found
foreach ($drivers['filelist'] as $class) {
$class = basename($class);
try {
// include the class code
require_once OEMBED_DRIVERS_DIR . $class;
// get class name
$class = str_replace(array('class.', '.php'), '', $class);
// create new instance
$class = new $class($url);
// add the class to the stack
self::$drivers[$class->getName()] = $class;
} catch (Exception $ex) {
throw new ServiceDriverException($url, $ex);
}
}
}
}
示例15: processForm
function processForm()
{
if (!$_POST['name']) {
return Messages::getString('CreateProjectPage.ProjectNameNotEmpty');
}
if (!$_POST['pwd']) {
return Messages::getString('CreateProjectPage.PasswordNotEmpty');
}
if ($_POST['pwd'] != $_POST['pwd2']) {
return Messages::getString('CreateProjectPage.PasswordsNotEqual');
}
if (!General::CheckPostMasterPassword()) {
return Messages::getString('CreateProjectPage.MasterPasswordWrong');
}
try {
$db = Database::getInstance();
$project_info = array('name' => stripslashes($_POST['name']), 'pwd' => stripslashes($_POST['pwd']), 'info' => Config::$default_project_info['info'], 'access' => Config::$default_project_info['access'], 'introduction' => Config::$default_project_info['introduction'], 'hint' => Config::$default_project_info['hint']);
if (!($this->new_project_id = $db->insertProject($project_info))) {
return sprintf("%s: %s", Messages::getString('General.dbError'), $db->lastError());
}
} catch (Exception $exception) {
// in this case, render exception as error.
return $exception;
}
return '';
}