本文整理汇总了PHP中nc_core函数的典型用法代码示例。如果您正苦于以下问题:PHP nc_core函数的具体用法?PHP nc_core怎么用?PHP nc_core使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nc_core函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($value = null)
{
$this->db = nc_core()->db;
if ($value) {
$this->set_value($value);
}
}
示例2: get_files_folder
/**
* Возвращает путь к папке netcat_files (от корня сайта), без слэша на конце
*
* @return string
*/
protected function get_files_folder()
{
// cannot do that in the constructor because $nc_core is not initialized there
if (!isset($this->files_folder)) {
$this->files_folder = rtrim(nc_core('SUB_FOLDER') . nc_core('HTTP_FILES_PATH'), '/\\');
}
return $this->files_folder;
}
示例3: get
/**
* @param string $option
* @return mixed
*/
public function get($option)
{
$value = parent::get($option);
if ($this->internal_encoding != $this->output_encoding) {
$value = nc_core('utf8')->conv($this->internal_encoding, $this->output_encoding, $value);
}
return $value;
}
示例4: nc_module_path
/**
* Путь (от корня сайта) к папке с модулями.
* E.g. nc_module_path('auth') → '/netcat/modules/auth/'
*
* @return string
*/
function nc_module_path()
{
$path = '';
if (func_num_args()) {
$args = func_get_args();
$path = implode('/', $args) . '/';
}
return nc_core('SUB_FOLDER') . nc_core('HTTP_ROOT_PATH') . 'modules/' . $path;
}
示例5: __construct
public function __construct(nc_template_view $template_view, $partial_file, array $data = array())
{
$this->template_view = $template_view;
if (nc_check_file($partial_file)) {
$this->partial_file = $partial_file;
}
$this->data = $data;
$this->data['nc_core'] = nc_core();
$this->data['db'] = nc_db();
}
示例6: init
/**
* Инициализация модуля:
* — Инициализация автоматической загрузки классов модуля
* — Если модуль не разу не запускался, будут созданы стандартные
* маршруты для всех сайтов
* — Привязка слушателей создания и удаления сайтов
*/
public static function init()
{
nc_core()->register_class_autoload_path('nc_routing_', dirname(__FILE__) . "/classes");
if (!nc_routing::get_setting('IsInstalled', 0)) {
nc_routing_route_defaults::create_for_all_sites();
self::set_setting('IsInstalled', 1, 0);
}
nc_routing_listener::init();
self::$SUB_FOLDER = nc_core::get_object()->SUB_FOLDER;
}
示例7: render_field
public function render_field()
{
$view = nc_core()->ui->view(dirname(__FILE__) . '/views/field.view.php');
$view->with('field', $this);
$view->with('field_name', $this->get_name());
$view->with('field_value_json', $this->get_value());
$view->with('data_source_config', array('ajax_path' => nc_core('SUB_FOLDER') . nc_core('HTTP_ROOT_PATH') . 'action.php?ctrl=system.form.fields.data_source.data_source'));
foreach ($this->default_settings as $key => $value) {
$view->with($key, $this->get($key));
}
return $view;
}
示例8: __construct
protected function __construct()
{
$this->nc_core = nc_core();
$this->table = nc_db_table::make('Subdivision');
$this->file_table = nc_db_table::make('Filetable', 'ID');
$this->routing_module_enabled = nc_module_check_by_keyword('routing');
$this->current_page_url = urldecode(strtok($_SERVER['REQUEST_URI'], '?'));
$this->current_sub_url = substr($this->current_page_url, 0, strrpos($this->current_page_url, "/") + 1);
if (!empty($GLOBALS['current_sub'])) {
$this->set_current_sub($GLOBALS['current_sub']);
}
$this->reset();
}
示例9: _edit_doc_link
function _edit_doc_link($row)
{
// global function inside a method... huh?
if (!$row["Subdivision_ID"]) {
return "";
}
// oops
$resolved_url_data = nc_resolve_url($row["Referrer_URL"]);
$url = parse_url($row["Referrer_URL"]);
$edit_link_params = array("sub" => nc_array_value($resolved_url_data, "folder_id"), "cc" => nc_array_value($resolved_url_data, "infoblock_id"), "message" => nc_array_value($resolved_url_data, "object_id"));
$edit_link = $url['scheme'] . "://" . $url['host'] . nc_core("SUB_FOLDER") . nc_core("HTTP_ROOT_PATH") . ($resolved_url_data["resource_type"] == "object" ? "message.php" : "") . "?" . (isset($url["query"]) ? $url["query"] . "&" : "") . http_build_query($edit_link_params);
return "<a href='" . htmlspecialchars($edit_link) . "' target='_blank'>" . NETCAT_MODULE_SEARCH_ADMIN_BROKEN_LINK_EDIT . "</a>";
}
示例10: site_select
/**
* Селектор сайта
* @param int $current_site_id
* @return string
*/
public static function site_select($current_site_id)
{
// @todo remove that 'helper' when global site selector is introduced
$sites = nc_core('catalogue')->get_all();
$options = array();
foreach ($sites as $id => $row) {
$options[$id] = $id . '. ' . $row['Catalogue_Name'];
}
$site_selector_id = 'nc_admin_site_select';
$site_selector = nc_core('ui')->html->select('site_id', $options, $current_site_id)->attr('id', $site_selector_id);
$nc = '$nc';
$site_selector .= "<script>\n (function() {\n {$nc}('#{$site_selector_id}').change(function() {\n var re = /site_id=\\d+/,\n loc = location.href,\n new_site_id = {$nc}(this).val(),\n new_site_loc = 'site_id=' + new_site_id;\n if (re.test(loc)) {\n location.href = loc.replace(/site_id=\\d+/, new_site_loc);\n }\n else {\n location.href += (loc.indexOf('?') ? '&' : '?' ) + new_site_loc;\n }\n });\n })();\n </script>";
return $site_selector;
}
示例11: check_hash_column_type
/**
* Убрать после отказа от поддержки MySQL 4.1.x
*/
protected function check_hash_column_type()
{
static $hash_column_type_checked = false;
if (!$hash_column_type_checked) {
$hash_length = nc_search_util::can_use_binary_columns() ? "20" : "40";
/** @var nc_db $db */
$db = nc_core('db');
$hash_column_definition = $db->get_row("SHOW COLUMNS FROM `Search_Link` LIKE 'Hash'", ARRAY_A);
if (!strpos($hash_column_definition['Type'], $hash_length)) {
$db->query("ALTER TABLE `Search_Link` CHANGE `Hash` `Hash` BINARY({$hash_length}) NOT NULL");
}
$hash_column_type_checked = true;
}
}
示例12: __construct
protected function __construct()
{
if (!$this->module_keyword) {
// cut prefix "nc_"
$this->module_keyword = strtolower(substr(get_class($this), 3));
}
if (!$this->module_folder) {
$this->module_folder = nc_core('MODULE_FOLDER') . $this->module_keyword . DIRECTORY_SEPARATOR;
}
// Загрузка подмодулей при старте
foreach ($this->submodules as $key => $submodule) {
if ($submodule === self::LOAD_ON_STARTUP) {
$this->load_submodule($key);
}
}
$this->init();
}
示例13: save_fields
public function save_fields($only_isset_post = false, $template = null, $fld_content = null)
{
if (null == $template) {
$template = $this->template;
}
if ($fld_content === null) {
$fld_content = nc_core('input')->fetch_post();
}
foreach ($template->fields->standart as $field => $tmp) {
if (!$only_isset_post || isset($fld_content[$field])) {
if ($field == 'RecordTemplate') {
$fld_content['RecordTemplate'] = nc_get_string_service_prefix_for_RecordTemplate() . $fld_content['RecordTemplate'] . nc_get_string_service_suffix_for_RecordTemplate();
}
nc_save_file($template->fields->get_path($field), $fld_content[$field]);
}
}
nc_tpl_parser::parts2main($template);
}
示例14: action_set_search_fields
public function action_set_search_fields($cc)
{
$fields = nc_core()->input->fetch_post('fields');
// print_r($fields);
$sub_class_table = nc_db_table::make('Sub_Class');
$field_table = nc_db_table::make('Field');
$class_id = $sub_class_table->where_id($cc)->get_value('Class_ID');
$field_table->where('Class_ID', $class_id)->update(array('DoSearch' => 0));
foreach ($fields as $id) {
$field_table->where_id($id)->update(array('DoSearch' => 1));
}
$back_url = $_SERVER['HTTP_REFERER'];
if (!$back_url) {
$back_url = nc_core()->SUB_FOLDER . nc_core()->HTTP_ROOT_PATH . '?inside_admin=1&cc=' . $cc;
}
$this->is_naked = true;
ob_get_level() and ob_end_clean();
header("Location: {$back_url}");
exit;
}
示例15: export_process
protected function export_process()
{
$id = $this->id;
$widget_class = $this->widget_class_table->where_id($id)->get_row();
if (!$widget_class) {
return false;
}
// Export data: Class
$data = array($id => $widget_class);
$this->dumper->export_data('Widget_Class', 'Widget_Class_ID', $data);
// Export data: Field
$data = $this->field_table->where('Widget_Class_ID', $id)->get_result();
$this->dumper->export_data('Field', 'Field_ID', $data);
// Export files
if ($widget_class['File_Mode']) {
$this->dumper->export_files(nc_core('HTTP_TEMPLATE_PATH') . 'widget', $widget_class['File_Path']);
}
$this->dumper->set_dump_info('widget_class_keyword', $widget_class['Keyword']);
$this->dumper->set_dump_info('file_mode', $template['File_Mode']);
}