当前位置: 首页>>代码示例>>PHP>>正文


PHP _class函数代码示例

本文整理汇总了PHP中_class函数的典型用法代码示例。如果您正苦于以下问题:PHP _class函数的具体用法?PHP _class怎么用?PHP _class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_class函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show

 function show()
 {
     $id = preg_replace('~[^a-z0-9_-]+~ims', '', $_GET['id']);
     if (strlen($id)) {
         if (substr($id, 0, strlen('table2_')) === 'table2_') {
             return _class($id, YF_PATH . '.dev/samples/table2/')->show();
         } else {
             return _class('docs')->_show_for($this);
         }
     }
     $ext = '.class.php';
     $ext_len = strlen($ext);
     $globs = ['yf_dev' => YF_PATH . '.dev/samples/table2/*' . $ext];
     $names = [];
     foreach ($globs as $glob) {
         foreach (glob($glob) as $cls) {
             $cls = basename($cls);
             if ($cls == __CLASS__ || false === strpos($cls, __FUNCTION__)) {
                 #					continue;
             }
             $name = substr($cls, 0, -$ext_len);
             $names[$name] = $name;
         }
     }
     $links = [];
     foreach ($names as $name) {
         $data[$name] = ['name' => $name, 'link' => url('/@object/@action/' . $name)];
     }
     return html()->li($data);
 }
开发者ID:yfix,项目名称:yf,代码行数:30,代码来源:sample_table.class.php

示例2: _site_map_items

 function _site_map_items($sm_obj)
 {
     if (!is_object($sm_obj)) {
         return false;
     }
     $shop_cats = _class('cats')->_get_items_array('shop_cats');
     foreach ((array) $shop_cats as $cid => $c) {
         if (!$c['parent_id']) {
             $top_level[$cid] = $cid;
         }
     }
     foreach ((array) $top_level as $cid) {
         $c =& $shop_cats[$cid];
         if (!$c['active']) {
             unset($shop_cats[$cid]);
             continue;
         }
         $sm_obj->_store_item(['url' => url('/shop/products/' . $cid)]);
     }
     $q = db()->query('SELECT id FROM ' . db('shop_products') . ' WHERE active="1" AND image="1"');
     while ($a = db()->fetch_assoc($q)) {
         $sm_obj->_store_item(['url' => url('/shop/product/' . $a['id'])]);
     }
     return true;
 }
开发者ID:yfix,项目名称:yf,代码行数:25,代码来源:yf_shop__site_map_items.class.php

示例3: product_details

 function product_details()
 {
     if (!$_GET["id"]) {
         return is_redirect("./?object=shop");
     }
     // Get products from database
     if (is_numeric($_GET["id"])) {
         $add_sql = "id= '" . intval($_GET["id"]);
     } else {
         $add_sql = "url='" . _es($_GET['id']);
     }
     $sql = "SELECT * FROM " . db('shop_products') . " WHERE active='1' AND " . $add_sql . "'";
     $product_info = db()->query_fetch($sql);
     // Required for comments
     module("shop")->_comments_params["object_id"] = $product_info["id"];
     module("shop")->_comments_params["objects_ids"] = $product_info["id"];
     $N = module("shop")->_get_num_comments();
     $N = $N[$product_info["id"]];
     if ($N == "") {
         $N = 0;
     }
     $dirs = sprintf("%06s", $product_info["id"]);
     $dir2 = substr($dirs, -3, 3);
     $dir1 = substr($dirs, -6, 3);
     $mpath = $dir1 . "/" . $dir2 . "/";
     $group_prices = module("shop")->_get_group_prices($product_info["id"]);
     $product_info["_group_price"] = $group_prices[module("shop")->USER_GROUP];
     module("shop")->_product_info = $product_info;
     $atts = module("shop")->_products_get_attributes($product_info["id"]);
     $thumb_path = $product_info["url"] . "_" . $product_info["id"] . "_" . $product_info["image"] . module("shop")->THUMB_SUFFIX . ".jpg";
     $img_path = $product_info["url"] . "_" . $product_info["id"] . "_" . $product_info["image"] . module("shop")->FULL_IMG_SUFFIX . ".jpg";
     if ($product_info["image"] == 0) {
         $image = "";
     } else {
         $image_files = _class('dir')->scan_dir(module("shop")->products_img_dir . $mpath, true, "/" . $product_info["url"] . "_" . $product_info["id"] . ".+?_small\\.jpg" . "/");
         $reg = "/" . $product_info["url"] . "_" . $product_info["id"] . "_(?P<content>[\\d]+)_small\\.jpg/";
         foreach ((array) $image_files as $filepath) {
             preg_match($reg, $filepath, $rezult);
             $i = $rezult["content"];
             if ($i != $product_info["image"]) {
                 $thumb_temp = module("shop")->products_img_webdir . $mpath . $product_info["url"] . "_" . $product_info["id"] . "_" . $i . module("shop")->THUMB_SUFFIX . ".jpg";
                 $img_temp = module("shop")->products_img_webdir . $mpath . $product_info["url"] . "_" . $product_info["id"] . "_" . $i . module("shop")->FULL_IMG_SUFFIX . ".jpg";
                 $replace2 = ["thumb_path" => $thumb_temp, "img_path" => $img_temp, "name" => $product_info["url"]];
                 $image .= tpl()->parse("shop/image_items", $replace2);
             }
         }
     }
     $URL_PRODUCT_ID = module("shop")->_product_id_url($product_info);
     $sql_man = "SELECT * FROM " . db('shop_manufacturers') . " WHERE id = " . $product_info["manufacturer_id"];
     $manufacturer = db()->query_fetch($sql_man);
     if (module("shop")->SHOW_products_similar_by_price == true) {
         $products_similar_by_price = module("shop")->products_similar_by_price($product_info["price"], $product_info["id"]);
     }
     if (module("shop")->products_similar_by_basket == true) {
         $products_similar_by_basket = module("shop")->products_similar_by_basket($product_info["id"]);
     }
     $replace = ["name" => _prepare_html($product_info["name"]), "model" => _prepare_html($product_info["model"]), "desc" => $product_info["description"], "manufacturer" => _prepare_html(module("shop")->_manufacturer[$product_info["manufacturer_id"]]["name"]), "url_manufacturer" => process_url("./?object=shop&action=products_show&id=" . module("shop")->_manufacturer[$product_info["manufacturer_id"]]["url"]), "date" => _format_date($product_info["add_date"], "long"), "price" => module("shop")->_format_price(module("shop")->_product_get_price($product_info)), "currency" => _prepare_html(module("shop")->CURRENCY), "thumb_path" => file_exists(module("shop")->products_img_dir . $mpath . $img_path) ? module("shop")->products_img_webdir . $mpath . $img_path : "", "img_path" => file_exists(module("shop")->products_img_dir . $mpath . $img_path) ? module("shop")->products_img_webdir . $mpath . $img_path : "", "image" => $image, "basket_add_url" => $product_info["external_url"] ? $product_info["external_url"] : process_url("./?object=shop&action=basket_add&id=" . $URL_PRODUCT_ID), "external_url" => intval((bool) $product_info["external_url"]), "back_url" => process_url("./?object=shop"), "show_basket_url" => process_url("./?object=shop&action=basket"), "dynamic_atts" => module("shop")->_get_select_attributes($atts), "cats_block" => module("shop")->_categories_show(), "cat_name" => _prepare_html(module("shop")->_shop_cats[$product_info["cat_id"]]), "cat_url" => process_url("./?object=shop&action=product_details&id=" . module("shop")->_shop_cats_all[$product_info["cat_id"]]['url']), 'comments' => module("shop")->_view_comments(), "N" => $N, "products_similar_by_price" => $products_similar_by_price, "products_similar_by_basket" => $products_similar_by_basket, "product_related" => module("shop")->products_related($product_info["id"])];
     db()->query("UPDATE " . db('shop_products') . " SET viewed = viewed+1 , last_viewed_date = " . time() . "  WHERE " . $add_sql . "'");
     return tpl()->parse("shop/details", $replace);
 }
开发者ID:yfix,项目名称:yf,代码行数:60,代码来源:yf_shop_product_details.class.php

示例4: test_patterns_t

 public function test_patterns_t()
 {
     $var = 'While searching %num folders found';
     $translation = 'В процессе поиска {Найдено %num папок|0:Папок не найдено|1:Найдена %num папка|2,3,4:Найдено %num папки|11-14:Найдено %num папок|Найдено %num папок}';
     _class('i18n')->TR_VARS['ru'][strtolower(str_replace(' ', '_', $var))] = $translation;
     _class('i18n')->_loaded['ru'] = true;
     $this->assertEquals('В процессе поиска Папок не найдено', t($var, ['%num' => '0'], 'ru'));
     $this->assertEquals('В процессе поиска Найдена 1 папка', t($var, ['%num' => '1'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 2 папки', t($var, ['%num' => '2'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 3 папки', t($var, ['%num' => '3'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 4 папки', t($var, ['%num' => '4'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 5 папок', t($var, ['%num' => '5'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 6 папок', t($var, ['%num' => '6'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 7 папок', t($var, ['%num' => '7'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 8 папок', t($var, ['%num' => '8'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 9 папок', t($var, ['%num' => '9'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 10 папок', t($var, ['%num' => '10'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 11 папок', t($var, ['%num' => '11'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 12 папок', t($var, ['%num' => '12'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 13 папок', t($var, ['%num' => '13'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 14 папок', t($var, ['%num' => '14'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 15 папок', t($var, ['%num' => '15'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 100 папок', t($var, ['%num' => '100'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 1222 папки', t($var, ['%num' => '1222'], 'ru'));
 }
开发者ID:yfix,项目名称:yf,代码行数:25,代码来源:class_i18n.Test.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     init_yf();
     $params = [];
     // Parse arguments like that: k1=v1 k2=v2 into array('k1' => 'v1', 'k2' => 'v2')
     foreach ((array) $input->getArgument('params') as $p) {
         list($k, $v) = explode('=', trim($p));
         $k = trim($k);
         $v = trim($v);
         if (strlen($k) && strlen($v)) {
             $params[$k] = $v;
         }
     }
     $method = $input->getArgument('method');
     $methods = get_class_methods(_class('core_api'));
     $methods = array_combine($methods, $methods);
     foreach ($methods as $name) {
         if ($name[0] == '_') {
             unset($methods[$name]);
         }
     }
     if ($method && in_array($method, $methods)) {
         $text = _class('core_api')->{$method}($params);
         $output->writeln($text);
     } else {
         $table = $this->getHelperSet()->get('table');
         $rows = [];
         foreach ($methods as $name) {
             $rows[] = [$name];
         }
         $table->setHeaders(['API method'])->setRows($rows);
         $table->render($output);
     }
 }
开发者ID:yfix,项目名称:yf,代码行数:34,代码来源:yf_console_core_api.class.php

示例6: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     if (false !== strpos(strtolower(get_called_class()), 'compiled')) {
         tpl()->COMPILE_TEMPLATES = self::$_bak;
         _class('dir')->delete_dir(STORAGE_PATH . 'stpls_compiled/', $delete_start_dir = true);
     }
 }
开发者ID:yfix,项目名称:yf,代码行数:7,代码来源:tpl__setup.php

示例7: pics_browser

 function pics_browser()
 {
     if (isset($_GET['active']) && $_GET['active'] == 1) {
         $active = ' AND p.active = \'1\' ';
     } elseif (isset($_GET['active']) && $_GET['active'] == 0) {
         $active = ' AND p.active = \'\' ';
     } else {
         $active = '';
     }
     if (main()->is_post()) {
         foreach ($_POST['delete'] as $k => $v) {
             list($id, $product_id) = explode("_", $k);
             module('manage_shop')->_product_image_delete($id, $product_id);
         }
     }
     $cats_list = _class('_shop_categories', 'modules/shop/')->recursive_get_child_ids(62521);
     $sql = "SELECT `i`.`product_id`,`i`.`id` FROM `" . db('shop_products') . "` AS `p`, `" . db('shop_product_images') . "` AS `i` WHERE `p`.`id`=`i`.`product_id` AND `p`.`cat_id` IN ('" . implode("','", $cats_list) . "')" . $active;
     list($add_sql, $pages, $total_records, $page_current, $pages_total, $pages_limited) = common()->divide_pages($sql);
     $R = db()->query($sql . $add_sql);
     $items = [];
     while ($A = db()->fetch_assoc($R)) {
         $_cls_products = _class('_shop_products', 'modules/shop/');
         $image = $_cls_products->_product_image($A['product_id'], true);
         $items[] = ['id' => $A['product_id'], 'image_id' => $A['id'], 'image' => $image['big']];
     }
     $replace = ['items' => $items, 'total' => $total_records, 'pages' => $pages];
     $tpl_name = 'manage_shop/pics_browser';
     return tpl()->parse($tpl_name, $replace);
 }
开发者ID:yfix,项目名称:yf,代码行数:29,代码来源:yf_manage_shop_pics_browser.class.php

示例8: show

 function show()
 {
     if ($_GET['id']) {
         return _class('docs')->_show_for($this);
     }
     $docs = _class('docs');
     asset('font-awesome4');
     foreach ($this->_get_assets() as $a) {
         $name = $a['name'];
         $sub = [];
         $sub[] = $docs->_github_link($a['path']);
         $content = $a['content'];
         $info = is_array($content) ? $content['info'] : [];
         if ($info['name']) {
             $sub[] = '<b>' . t('name') . '</b>: ' . $info['name'];
         }
         if ($info['desc']) {
             $sub[] = '<b>' . t('desc') . '</b>: ' . $info['desc'];
         }
         if ($info['url']) {
             $sub[] = '<b>' . t('url') . '</b>: <a href="' . _prepare_html($info['url']) . '">' . _prepare_html($info['url']) . '</a>';
         }
         if ($info['git']) {
             $sub[] = '<b>' . t('git') . '</b>: <a href="' . $info['git'] . '">' . $info['git'] . '</a>';
         }
         $data[$name] = ['name' => $name, 'link' => url('/@object/@action/#' . $name), 'sub' => $sub, 'id' => $name];
     }
     return html()->li($data);
 }
开发者ID:yfix,项目名称:yf,代码行数:29,代码来源:sample_assets.class.php

示例9: _init

 function _init()
 {
     $payment_api =& $this->payment_api;
     $manage_lib =& $this->manage_payment_lib;
     $provider_name =& $this->provider_name;
     $provider_class =& $this->provider_class;
     // class
     $payment_api = _class('payment_api');
     $manage_payment_lib = module('manage_payment_lib');
     // provider
     $provider_class = $payment_api->provider_class(['provider_name' => $provider_name]);
     // property
     $object =& $this->object;
     $action =& $this->action;
     $id =& $this->id;
     $filter_name =& $this->filter_name;
     $filter =& $this->filter;
     $url =& $this->url;
     // setup property
     $object = $_GET['object'];
     $action = $_GET['action'];
     $id = $_GET['id'];
     $filter_name = $object . '__' . $action;
     $filter = $_SESSION[$filter_name];
     // url
     $url = ['list' => url_admin(['is_full_url' => true, 'object' => $object, 'action' => 'show']), 'authorize' => url_admin(['is_full_url' => true, 'object' => $object, 'action' => 'authorize']), 'request_interkassa' => url_admin(['object' => $object, 'action' => 'request_interkassa', 'operation_id' => '%operation_id'])];
 }
开发者ID:yfix,项目名称:yf,代码行数:27,代码来源:yf_manage_payment_yandexmoney.class.php

示例10: test_captcha

 public function test_captcha()
 {
     ob_start();
     _class('captcha')->show_image($no_header = true, $no_exit = true);
     $img = ob_get_clean();
     $this->assertNotEmpty($img);
     $this->assertGreaterThan(2000, strlen($img));
 }
开发者ID:yfix,项目名称:yf,代码行数:8,代码来源:class_captcha.Test.php

示例11: form_render_out

 /**
  */
 function form_render_out($content, $extra = [], $replace = [], $obj)
 {
     $css_framework = $extra['css_framework'] ?: conf('css_framework');
     if (!$css_framework) {
         $css_framework = $this->DEFAULT_CSS_FRAMEWORK;
     }
     return _class('html5fw_' . $css_framework, 'classes/html5fw/')->form_render_out($content, $extra, $replace, $obj);
 }
开发者ID:yfix,项目名称:yf,代码行数:10,代码来源:yf_html5fw.class.php

示例12: connect

 /**
  * Do connect to the low level driver
  */
 function connect()
 {
     if (!$this->_connection) {
         $this->_connection = _class('pubsub_driver_' . $this->driver, 'classes/pubsub/');
         $this->_connection->connect();
     }
     return $this->_connection;
 }
开发者ID:yfix,项目名称:yf,代码行数:11,代码来源:yf_wrapper_pubsub.class.php

示例13: _init

 public function _init()
 {
     if (!$this->ENABLE) {
         return null;
     }
     $this->payment_api = _class('payment_api');
     !empty($this->service_allow) && ($this->description = implode(', ', $this->service_allow));
 }
开发者ID:yfix,项目名称:yf,代码行数:8,代码来源:yf_payment_api__provider.class.php

示例14: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     self::$_bak_settings['REWRITE_MODE'] = $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'];
     $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = true;
     $_GET = ['object' => 'dynamic', 'action' => 'unit_test_form'];
     $_SERVER['HTTP_HOST'] = self::$host;
     _class('rewrite')->DEFAULT_HOST = self::$host;
 }
开发者ID:yfix,项目名称:yf,代码行数:8,代码来源:class_rewrite_testing_admin.php

示例15: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $_GET = ['object' => 'dynamic', 'action' => 'unit_test_form', 'id' => 'id/with/slashes'];
     self::$_bak_settings['REWRITE_MODE'] = $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'];
     $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = true;
     $GLOBALS['CONF']['form2']['CONF_CSRF_PROTECTION'] = false;
     _class('form2')->CONF_CSRF_PROTECTION = false;
 }
开发者ID:yfix,项目名称:yf,代码行数:8,代码来源:class_form_rewrite.Test.php


注:本文中的_class函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。