本文整理汇总了PHP中obj类的典型用法代码示例。如果您正苦于以下问题:PHP obj类的具体用法?PHP obj怎么用?PHP obj使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了obj类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Exclude pages from search
*
* @param obj $query the query object
* @return obj the modified object
*/
function tz_exclude_pages($query)
{
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
示例2: showBrand
/**
* 单一品牌商品列表
*
*/
private function showBrand()
{
$brand_id = intval($this->_input['brandid']);
if ($brand_id == 0) {
header("Location:?action=index");
exit;
}
/*品牌信息*/
$brand_info = $this->obj_brand->getBrandInfo(array('brand_id' => $brand_id));
$this->output('brand_info', $brand_info);
/*创建分页对象*/
$view_list_num = $this->_viewinfo['websit']['other_brand_class'] == '1' ? (int) $this->_viewinfo['websit']['other_brand_class_num'] : 0;
if (intval($this->_input['goods_nums']) != 0) {
$view_list_num = intval($this->_input['goods_nums']);
}
require_once "commonpage.class.php";
$obj_page = new CommonPage();
$obj_page->pagebarnum($view_list_num);
$brand_product = $this->obj_brand->productBrandList(array('brand_id' => intval($this->_input['brandid'])), $obj_page, '*', $this->_input['goods_show']);
$product_brand_page = $obj_page->show(6);
$this->output('product_brand_page', $product_brand_page);
$this->output('brand_product', $brand_product);
/*该品牌热门商品*/
$hot_array = array();
$hot_array = array('brand_id' => intval($this->_input['brandid']), 'order_value' => 'goods_click', 'limit_num' => 8);
$brand_hot = $this->obj_brand->getBrandProduct($hot_array);
$this->output('brand_hot', $brand_hot);
/*推荐品牌,暂时无此字段*/
$brand_commend = $this->obj_brand->getBrandList(array('show_type' => 'class_show'));
$this->output('brand_commend', $brand_commend);
$this->showpage('product_brand_list');
}
示例3: dispatch
/**
* 実行ファイル指定処理
*
* @access private
* @return
*/
public function dispatch()
{
// 実行ファイル
$controller = $this->request_obj->getController();
// 実行コントローラーファイル取得
$controller_file = $controller . '_controller.php';
// 実行コントローラーまでのパス取得
$controller_path = APP_CONTROLLERS_PATH . $controller_file;
// 実行コントローラー存在チェック
if (file_exists($controller_path) == false) {
$controller = 'error';
$controller_path = APP_CONTROLLERS_PATH . 'error_controller.php';
}
// 実行コントローラー名格納
$this->controller_name = $controller;
// 実行コントローラー読み込み
include_once $controller_path;
// クラス名にフォーマット
$controller_class = ucfirst($controller) . 'Controller';
// インスタンス生成
$this->con_obj = new $controller_class($this);
// 指定アクション名取得
$action = $this->request_obj->getAction();
// アクション名存在チェック
if (empty($action)) {
$action = 'index';
} elseif (!is_callable(array(&$this->con_obj, $action))) {
$action = 'error';
}
// 実行アクション名格納
$this->action_name = $action;
// 初期処理実行
$this->con_obj->startup();
}
示例4: showCart
/**
* 购物车信息
*
*/
function showCart()
{
$goods_count = $this->obj_shop_cart->GoodsCount();
$this->output('goods_count', $goods_count);
//购买商品数量
$this->showpage('cart_window');
}
示例5: process_site
/**
* Process a site and pull all it's posts
*
* @param int $site_id The ID of the site for which to pull it's posts
* @param obj $client The syndication client class instance
* @return array|bool Array of posts on success, false on failure
*/
public function process_site($site_id, $client)
{
global $site_manager, $client_manager;
// Fetch the site status
if (!in_array($site_manager->get_site_status($site_id), array('idle', ''))) {
return false;
}
// Mark site as in progress
$site_manager->update_site_status('pulling');
try {
// Fetch the site's posts by calling the class located at the
// namespace given during registration
$posts = $client->get_posts($site_id);
/**
* Filter the array of posts to be processed by a pull client.
*
* @param array $posts The array of Types\Post objects to be pulled.
* @param int $site_id The id of the site being processed.
* @param Pull_Client $client The pull client processing the posts.
*/
$posts = apply_filters('syn_pre_pull_posts', $posts, $site_id, $client);
// Process the posts we fetched
$this->process_posts($posts, $site_id, $client);
} catch (\Exception $e) {
Syndication_Logger::log_post_error($site_id, $status = 'error', $message = __('Exception processing site.', 'push-syndication'), $log_time = null, $extra = array('error' => $e));
}
// Update site status
$site_manager->update_site_status('idle');
if (is_array($posts) && !empty($posts)) {
return $posts;
} else {
return false;
}
}
示例6: _process
/**
* Process function
*
* @param obj $node
*/
private static function _process($node)
{
$occurance = [];
$result = [];
if ($node->childNodes != null) {
foreach ($node->childNodes as $key => $child) {
if (array_key_isset($child->nodeName, $occurance)) {
$occurance[$child->nodeName]++;
} else {
$occurance[$child->nodeName] = 1;
}
}
}
if ($node->nodeType == XML_TEXT_NODE) {
$result = html_entity_decode(htmlentities($node->nodeValue, ENT_COMPAT, 'UTF-8'), ENT_COMPAT, 'UTF-8');
} else {
if ($node->nodeType == XML_CDATA_SECTION_NODE) {
$result = html_entity_decode(htmlentities($node->nodeValue, ENT_COMPAT, 'UTF-8'), ENT_COMPAT, 'UTF-8');
} else {
if ($node->hasChildNodes()) {
$children = $node->childNodes;
for ($i = 0; $i < $children->length; $i++) {
$child = $children->item($i);
if ($child->nodeName != '#text' && $child->nodeName != '#cdata-section') {
if ($occurance[$child->nodeName] > 1) {
$result[$child->nodeName][] = self::_process($child);
} else {
$result[$child->nodeName] = self::_process($child);
}
} else {
if ($child->nodeName == '#cdata-section') {
$text = self::_process($child);
if (trim($text) != '') {
// $result[$child->nodeName] = self::_process($child);
$result['#text'] = (string) $text;
}
} else {
if ($child->nodeName == '#text') {
$text = self::_process($child);
if (trim($text) != '') {
// $result[$child->nodeName] = self::_process($child);
$result[$child->nodeName] = (string) $text;
}
}
}
}
}
}
if ($node->hasAttributes()) {
$attributes = $node->attributes;
if (!is_null($attributes)) {
foreach ($attributes as $key => $attr) {
$result['@' . $attr->name] = $attr->value;
}
}
}
}
}
return $result;
}
示例7: slug_ensure_single_pod
/**
* Checks if given Pods object has the correct item fetch, and if not fetch it.
*
* @param obj|Pod $pod A Pod object to check
* @param int $id ID of item you want.
*
* @return Pods object
*/
function slug_ensure_single_pod($pod, $id)
{
if ($pod->id() !== $id || $pod->id === 0 || is_null($pod->id)) {
$pod->fetch($id);
}
return $pod;
}
示例8: _getClassSourse
/**
* 获取源代码
*
* @param obj $class 反射类实例
* @return string
*/
private static function _getClassSourse($class)
{
$path = $class->getFileName();
$lines = @file($path);
$from = $class->getStartLine();
$to = $class->getEndLine();
$len = $to - $from + 1;
return implode(array_slice($lines, $from - 1, $len));
}
示例9: addClass
/**
* function for adding class name
* @author Eleri<eleri.apsolon@gmail.com>
* @param obj $elem element
* @param string $cls new probably additional class name
*/
function addClass($elem, $cls)
{
$a = explode(" ", $elem->getClassName());
//mixed array_search ( $needle , array $haystack [, bool $strict = false ] )
if (array_search($cls, $a, true) === false) {
$a[] = $cls;
}
$elem->setClassName(implode(" ", $a));
}
示例10: Update
/**
* Update data in Excel table
*
* @param obj $objPHPExcel PHP Excel object
* @param int $row Row id
* @param int $sum_old Sum of items
* @param string $currentDate Current date
*
* @return obj $objPHPExcel PHP Excel object.
*/
public function Update($objPHPExcel, $row, $sum_old, $currentDate)
{
$this->load->model('Database');
$sum_new = $this->db->count_all_results('exercises');
if ($sum_new > $sum_old) {
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $currentDate)->setCellValue('B' . $row, $sum_new);
}
return $objPHPExcel;
}
示例11: set_portfolio_post_type_admin_order
/**
* Set the default order on the portfolio posts page to display by
* menu order and not date
*
* @param obj $query The original query object
* @return void
*/
function set_portfolio_post_type_admin_order($query)
{
if (is_admin()) {
$post_type = $query->query['post_type'];
if ($post_type == 'portfolio' && empty($_GET['orderby'])) {
$query->set('orderby', 'menu_order');
$query->set('order', 'ASC');
}
}
}
示例12: showIndex
/**
* 友情链接
*
*/
private function showIndex()
{
/*友情链接*/
$link_image = $this->obj_shop_link->getLinkList(array('logo' => 1), '');
$this->output('link_image', $link_image);
$link_text = $this->obj_shop_link->getLinkList(array('logo' => 2), '');
$this->output('text_link_num', count($link_text));
$this->output('link_text', $link_text);
$this->shopshowpage("links");
}
示例13: executeHook
/**
* Parser Hook
*
* The following method is assigned to a hook, which will be run whenever
* the user adds a <bugs /> tag in the main MediaWiki code.
*
* @param string $text
* @param array $args
* @param obj $parser
* @return str
*/
public static function executeHook($text, $args = array(), $parser)
{
$parser->disableCache();
// Set the page namespace
$namespace['dbKey'] = $parser->getTitle()->getPrefixedDBkey();
$namespace['text'] = $parser->getTitle()->getPrefixedText();
$isParserHook = true;
// Process request
$instance = self::_getInstance();
$output = $instance->_processActionRequest($namespace, $isParserHook, $args);
return $output;
}
示例14: footer
private function footer()
{
$info_array = $this->obj_shopnc_info->getSystemList();
$this->output('info_array', $info_array);
$this->showpage('footer');
/*访问记录*/
//$input_param['ip'] = $this->agent_ip; //ip
//$input_param['ip_area'] = "null"; //来源地区
//$input_param['visit_url'] = $this->cur_url; //访问地址
//$input_param['source_url'] = $this->refer_url; //来源地址
//$input_param['visit_system'] = $this->obj_shop_visit->getOS($_SERVER['HTTP_USER_AGENT']);//访问系统
//$this->obj_shop_visit->addVisit($input_param);
}
示例15: login
/**
* Login API
* @param string $email email of user
* @param string $password password of user
* @param obj $mysqli mysql connection
* @return bool success or not
*/
function login($email, $password, $mysqli)
{
// Using prepared statements means that SQL injection is not possible.
if ($stmt = $mysqli->prepare("SELECT id, username, password, salt\n FROM members\n WHERE email = ?\n LIMIT 1")) {
$stmt->bind_param('s', $email);
// Bind "$email" to parameter.
$stmt->execute();
// Execute the prepared query.
$stmt->store_result();
// get variables from result.
$stmt->bind_result($user_id, $username, $db_password, $salt);
$stmt->fetch();
// hash the password with the unique salt.
$password = hash('sha512', $password . $salt);
if ($stmt->num_rows == 1) {
// If the user exists we check if the account is locked
// from too many login attempts
if (checkbrute($user_id, $mysqli) == true) {
// Account is locked
// Send an email to user saying their account is locked
return false;
} else {
// Check if the password in the database matches
// the password the user submitted.
if ($db_password == $password) {
// Password is correct!
// Get the user-agent string of the user.
$user_browser = $_SERVER['HTTP_USER_AGENT'];
// XSS protection as we might print this value
$user_id = preg_replace("/[^0-9]+/", "", $user_id);
$_SESSION['user_id'] = $user_id;
// XSS protection as we might print this value
$username = preg_replace("/[^a-zA-Z0-9_\\-]+/", "", $username);
$_SESSION['username'] = $username;
$_SESSION['login_string'] = hash('sha512', $password . $user_browser);
// Login successful.
return true;
} else {
// Password is not correct
// We record this attempt in the database
$now = time();
$mysqli->query("INSERT INTO login_attempts(user_id, time)\n VALUES ('{$user_id}', '{$now}')");
return false;
}
}
} else {
// No user exists.
return false;
}
}
}