本文整理汇总了PHP中nc_Core::get_object方法的典型用法代码示例。如果您正苦于以下问题:PHP nc_Core::get_object方法的具体用法?PHP nc_Core::get_object怎么用?PHP nc_Core::get_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nc_Core
的用法示例。
在下文中一共展示了nc_Core::get_object方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
protected function __construct()
{
parent::__construct();
$host = null;
$port = null;
$nc_core = nc_Core::get_object();
$catalogue = $nc_core->catalogue->get_by_host_name($_SERVER['HTTP_HOST']);
if ($catalogue) {
$catalogueID = (int) $catalogue['Catalogue_ID'];
$sql = "SELECT *, UNIX_TIMESTAMP(`Audit_Begin`) AS Audit_Begin " . "FROM `Cache_Settings` " . "WHERE `Catalogue_ID` = {$catalogueID}";
$settings = $nc_core->db->get_row($sql, ARRAY_A);
$host = $settings['Memcached_Host'];
$port = $settings['Memcached_Port'];
}
$this->set_server($host, $port);
// проверка наличия расширения
if (!class_exists('Memcache')) {
throw new Exception(NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED_DOESNT_EXIST);
}
$this->memcache = new Memcache();
// соединение с сервером
if (!@$this->memcache->connect($this->host, $this->port)) {
throw new Exception(NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED_ERROR);
}
}
示例2: render_value_field
/**
* @access private
*/
function render_value_field($html = true)
{
$nc_core = nc_Core::get_object();
$ret = '';
$textarea_id = $this->get_textarea_id();
if ($this->embededitor) {
$windowWidth = 750;
$windowHeight = 605;
switch (nc_Core::get_object()->get_settings('EditorType')) {
default:
case 2:
$editor_name = 'FCKeditor';
break;
case 3:
$editor_name = 'ckeditor4';
$windowWidth = 1100;
$windowHeight = 420;
break;
case 4:
$editor_name = 'tinymce';
break;
}
$link = "editors/{$editor_name}/neditor.php";
$ret .= "<button type='button' onclick=\"window.open('" . $nc_core->SUB_FOLDER . $nc_core->HTTP_ROOT_PATH . $link . "?form=adminForm&control=" . $textarea_id . "', 'Editor', 'width={$windowWidth},height={$windowHeight},resizable=yes,scrollbars=no,toolbar=no,location=no,status=no,menubar=no');\">" . TOOLS_HTML_INFO . "</button><br />";
}
$value = $this->value ? $this->value : $this->default_value;
$ret .= "<textarea id='" . $textarea_id . "' name='" . $this->get_field_name() . "' rows='" . $this->size . "' class='ncf_value_textarea" . ($this->codemirror ? "" : " no_cm") . "'>" . htmlspecialchars($value, ENT_QUOTES) . "</textarea>";
if ($html) {
$ret = "<div class='ncf_value'>" . $ret . "</div>\n";
}
return $ret;
}
示例3: set_value
public function set_value($value)
{
$nc_core = nc_Core::get_object();
$this->value = false;
if (preg_match("/(\\d+)\\-(\\d+)\\-(\\d+) (\\d*):(\\d*):(\\d*)/", $value, $match)) {
$this->year = $match[1];
$this->month = $match[2];
$this->day = $match[3];
$this->hours = $match[4];
$this->minutes = $match[5];
$this->seconds = $match[6];
}
$this->value['day'] = $this->day;
$this->value['month'] = $this->month;
$this->value['year'] = $this->year;
$this->value['hours'] = $this->hours;
$this->value['minutes'] = $this->minutes;
$this->value['seconds'] = $this->seconds;
if ($this->day) {
$this->value['date'] = $this->day . "." . $this->month . "." . $this->year;
}
if ($this->hours) {
$this->value['time'] = $this->hours . ":" . $this->minutes . ":" . $this->seconds;
}
$this->value['datetime'] = $this->value['date'] . " " . $this->value['time'];
return 0;
}
示例4: __construct
public function __construct()
{
// inherit
parent::__construct();
// get nc_core
$this->core = nc_Core::get_object();
}
示例5: get_index_path
/**
*
* @return string
*/
protected function get_index_path()
{
$path = $this->get_setting('ZendSearchLucene_IndexPath');
$path = str_replace("%FILES%", nc_Core::get_object()->get_variable("FILES_FOLDER"), $path);
$path = str_replace("//", "/", $path);
return $path;
}
示例6: __construct
/**
* Class constructor method
*/
public function __construct($url = null, $remove_sub_folder = true)
{
// load parent constructor
parent::__construct();
if (is_string($url)) {
// Передана строка
$this->url = $url;
} else {
// Использовать текущий запрошенный URL
if ($url) {
trigger_error("nc_url: URL must be a string, " . gettype($url) . "provided. Using REQUEST_URI as an URL", E_USER_WARNING);
}
$nc_core = nc_Core::get_object();
$request_uri = urldecode($nc_core->REQUEST_URI);
$url = "http" . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? "s" : "") . "://" . getenv("HTTP_HOST") . $request_uri;
// надо сохранить get-параметры из окружения
if (($start = strpos(getenv("REQUEST_URI"), '?')) !== false) {
$env_query_string = substr(urldecode(getenv("REQUEST_URI")), $start + 1);
$url_query_start = strpos($url, '?');
if ($url_query_start !== false) {
$url = substr($url, 0, $url_query_start) . '?' . $env_query_string;
} else {
$url .= '?' . $env_query_string;
}
}
$this->url = $url;
}
$this->remove_sub_folder = $remove_sub_folder;
}
示例7: __construct
/**
*
*/
public function __construct()
{
set_time_limit(0);
ignore_user_abort(true);
nc_Core::get_object()->db->query("SET wait_timeout=900");
// might loose connection when running in slow mode
nc_search::enable_error_logging();
}
示例8: convert
public function convert($ClassID, $action = 'convert')
{
$nc_core = nc_Core::get_object();
$db = $nc_core->db;
$fs = $action == 'convert' ? 1 : 0;
if ($action == 'convert') {
$this->db->query("UPDATE `Class` SET `File_Mode` = 1, `File_Path` = IF(`ClassTemplate` > 0, CONCAT('/', `ClassTemplate`, '/', `Class_ID`,'/'), CONCAT('/', `Class_ID`,'/')) WHERE `Class_ID` = " . $ClassID . " OR `ClassTemplate` = " . $ClassID);
}
if ($this->db->errno) {
return nc_print_status(CONTROL_CLASS_CONVERT_DB_ERROR, 'error', null, 1);
}
$classes_data = $this->db->get_results("SELECT * FROM `Class` WHERE `Class_ID` = " . $ClassID . " OR `ClassTemplate` = " . $ClassID . " ORDER BY `ClassTemplate` ASC", ARRAY_A);
foreach ($classes_data as $class_data) {
$templates = $this->get_class_templates_list();
//save tpls
$class_editor = new nc_class_editor($nc_core->CLASS_TEMPLATE_FOLDER, $db);
$class_editor->load($class_data['ClassTemplate']);
$path = $class_editor->get_absolute_path() . $class_data['Class_ID'] . "/class_v40_backup.html";
if ($action == 'convert') {
$new_temlates = $this->convert_class_templates($class_data);
$class_editor->save_new_class($class_data['Class_ID'], $new_temlates);
foreach ($templates as $field_name => $tmp) {
$fields[$field_name] = "<!-- {$field_name} -->" . $class_data[$field_name] . "<!-- /{$field_name} -->";
}
$backup_content = join("\n\n", $fields);
nc_save_file($path, $backup_content);
} else {
$restore_content = nc_check_file($path) ? nc_get_file($path) : false;
if (!$restore_content) {
return nc_print_status(CONTROL_CLASS_CONVERT_UNDO_FILE_ERROR, 'error', null, 1);
}
foreach ($templates as $field_name => $tmp) {
if (preg_match("#<!-- ?{$field_name} ?-->(.*)<!-- ?/ ?{$field_name} ?-->#is", $restore_content, $matches)) {
$restored_templates[$field_name] = $matches[1];
}
}
if ($restored_templates && is_array($restored_templates)) {
$query = array();
foreach ($restored_templates as $field_name => $tmp) {
$query[] = "`" . $field_name . "` = '" . $db->prepare($tmp) . "'";
}
// сообственно, добавление
$SQL = "\nUPDATE `Class`";
$SQL .= "\n SET `File_Mode` = 0 , " . join(",\n ", $query);
$SQL .= "\n WHERE `Class_ID` = " . $class_data['Class_ID'];
$this->db->query($SQL);
if ($this->db->errno) {
return nc_print_status(CONTROL_CLASS_CONVERT_DB_ERROR, 'error', null, 1);
}
}
}
$message = nc_print_status(CONTROL_CLASS_CONVERT_OK, 'OK', null, 1);
$message .= "<a href='index.php?phase=4&ClassID=" . $ClassID . "&fs=" . $fs . "'>" . CONTROL_CLASS_CONVERT_OK_GOEDIT . "</a>";
}
return $message;
//no errors
}
示例9: nc_htmleditor_save
function nc_htmleditor_save()
{
$nc_core = nc_Core::get_object();
$skin = $_POST['ck_skin'] ? $_POST['ck_skin'] : 'kama';
$data = "<settings>\r\n\t<param name='ck_skin'>" . htmlspecialchars($skin) . "</param>\r\n</settings>";
if (!@file_put_contents($nc_core->ROOT_FOLDER . "editors/nc_settings.xml", $data)) {
print "error";
}
}
示例10: AddSystemMessage
function AddSystemMessage($Message, $Description)
{
global $db;
$nc_core = nc_Core::get_object();
if (!$nc_core->NC_UNICODE) {
$Message = $nc_core->utf8->utf2win($Message);
}
$db->query("INSERT INTO `SystemMessage`\n\t\t(`Message`, `Description`)\n\t\tVALUES\n\t\t('" . $db->escape($Message) . "', '" . $db->escape($Description) . "')");
return $db->insert_id;
}
示例11: __construct
/**
*
*/
public function __construct($view, $params)
{
$this->tabs = array(array('id' => 'info', 'caption' => NETCAT_MODULE_SEARCH_ADMIN_INFO, 'location' => "module.search.info"), array('id' => 'indexing', 'caption' => NETCAT_MODULE_SEARCH_ADMIN_INDEXING, 'location' => "module.search.indexing"), array('id' => 'lists', 'caption' => NETCAT_MODULE_SEARCH_ADMIN_LISTS, 'location' => "module.search.queries"), array('id' => 'settings', 'caption' => NETCAT_MODULE_SEARCH_ADMIN_SETTINGS, 'location' => "module.search.generalsettings"));
$this->activeTab = $view;
$this->locationHash = "module.search.{$view}" . ($params ? "({$params})" : "");
$this->treeMode = "modules";
$nc_core = nc_Core::get_object();
$module_settings = $nc_core->modules->get_by_keyword('search');
$this->treeSelectedNode = "module-{$module_settings['Module_ID']}";
}
示例12: ui_config_module_stats
function ui_config_module_stats($view, $sub_view, $phase)
{
$this->tabs[] = array('id' => "openstat", 'caption' => NETCAT_MODULE_STATS_ADMIN_TAB_OPENSTAT, 'location' => "module.stats.openstat");
$this->tabs[] = array('id' => "nc_stat", 'caption' => NETCAT_MODULE_STATS_ADMIN_TAB_NC_STAT, 'location' => "module.stats.nc_stat");
$this->tabs[] = array('id' => "settings", 'caption' => STRUCTURE_TAB_SETTINGS, 'location' => "module.stats.settings");
$this->activeTab = $view;
$this->locationHash = "module.stats." . $view . ($sub_view ? "." . $sub_view : "") . ($phase ? "(" . $phase . ")" : "");
$this->treeMode = "modules";
$module_settings = nc_Core::get_object()->modules->get_by_keyword('stats');
$this->treeSelectedNode = "module-" . $module_settings['Module_ID'];
}
示例13: SystemTableList
/**
* Выведем список системных таблиц
*/
function SystemTableList()
{
global $db, $UI_CONFIG, $ADMIN_PATH;
$nc_core = nc_Core::get_object();
$nc_core->load('modules');
$UI_CONFIG = new ui_config_system_classes('systemclass.list');
// reinit old value from class/function.inc.php
$UI_CONFIG->headerText = SECTION_SECTIONS_OPTIONS_SYSTEM;
?>
<form method='post' action='index.php'>
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tr><td>
<table class='nc-table nc--striped nc--hovered' width='100%'>
<tr>
<th>ID</th>
<th width='60%'><?php
echo CONTROL_SCLASS_TABLE;
?>
</th>
<th width='30%'><?php
echo CONTROL_SCLASS_ACTION;
?>
</th>
<th width='10%'><?php
echo CONTROL_CLASS_FIELDS;
?>
</th>
</tr>
<?php
$select = "SELECT a.System_Table_ID, a.System_Table_Rus_Name,b.Class_ID,IF(b.AddTemplate<>'' OR b.AddCond<>'' OR b.AddActionTemplate<>'',1,0) AS IsAdd, IF(b.EditTemplate<>'' OR b.EditCond<>'' OR b.EditActionTemplate<>'' OR b.CheckActionTemplate<>'' OR b.DeleteActionTemplate<>'',1,0) AS IsEdit, IF(b.SearchTemplate<>'' OR b.FullSearchTemplate<>'',1,0) AS IsSearch, IF(b.SubscribeTemplate<>'' OR b.SubscribeCond<>'',1,0) AS IsSubscribe, COUNT(f.Field_ID) AS `Fields`\n\t\tFROM System_Table AS a\n\t\tLEFT JOIN Class AS b ON a.System_Table_ID=b.System_Table_ID\tAND b.ClassTemplate = 0 AND b.File_Mode =" . +$_REQUEST['fs'] . "\n\t\tLEFT JOIN Field AS f ON f.System_Table_ID = a.System_Table_ID\n\t\tGROUP BY a.System_Table_ID\n\t\tORDER BY a.System_Table_ID";
$Result = $db->get_results($select, ARRAY_N);
foreach ($Result as $Array) {
if ($Array[0] == 3) {
//$Array[7] = $Array[7] / 2;
} else {
if (!+$_REQUEST['fs']) {
continue;
}
}
print "<tr>";
print "<td>" . $Array[0] . "</td>";
print "<td " . (!$Array[2] ? "colspan=2 " : "") . "bgcolor=white>" . ($Array[2] && $nc_core->modules->get_by_keyword('auth', 0) ? "<a href=" . $ADMIN_PATH . "field/system.php?fs=" . +$_REQUEST['fs'] . "&phase=2&SystemTableID=" . $Array[0] . ">" : "<a href=" . $ADMIN_PATH . "field/index.php?fs=" . +$_REQUEST['fs'] . "&isSys=1&SystemTableID=" . $Array[0] . ">") . constant($Array[1]) . "</a></td>";
if ($Array[2]) {
print "<td>\n\t\t\t\t\t<a href=" . $ADMIN_PATH . "field/system.php?fs=" . +$_REQUEST['fs'] . "&phase=4&SystemTableID=" . $Array[0] . "&myaction=1>" . (!$Array[3] ? "<font color=gray>" : "") . CONTROL_CLASS_ACTIONS_ADD . "</a> \n\t\t\t\t\t<a href=" . $ADMIN_PATH . "field/system.php?fs=" . +$_REQUEST['fs'] . "&phase=4&SystemTableID=" . $Array[0] . "&myaction=2>" . (!$Array[4] ? "<font color=gray>" : "") . CONTROL_CLASS_ACTIONS_EDIT . "</a> \n\t\t\t\t\t<a href=" . $ADMIN_PATH . "field/system.php?fs=" . +$_REQUEST['fs'] . "&phase=4&SystemTableID=" . $Array[0] . "&myaction=3>" . (!$Array[5] ? "<font color=gray>" : "") . CONTROL_CLASS_ACTIONS_SEARCH . "</a></td>";
}
print "<td><a class=\"nc-label nc--blue\" href=\"" . $ADMIN_PATH . "field/index.php?fs=" . +$_REQUEST['fs'] . "&isSys=1&SystemTableID=" . $Array[0] . "&fs=" . +$_REQUEST['fs'] . "\">" . $Array[7] . " " . mb_strtolower(plural_form($Array[7], CONTROL_CLASS_FIELD, CONTROL_CLASS_FIELDS, CONTROL_CLASS_FIELDS_COUNT)) . "</a></td>\n";
print "</tr>";
}
?>
</table>
</td></tr>
</table>
<?php
}
示例14: get_urls
public function get_urls()
{
$res = array();
$site_settings = nc_Core::get_object()->catalogue->get_all();
foreach ($site_settings as $s) {
if ($s["Domain"]) {
$res[] = "http://{$s['Domain']}/";
}
}
return $res;
}
示例15: get_description
public function get_description()
{
$site_id = $this->get_id();
$link = "{$GLOBALS['ADMIN_PATH']}#site.map({$site_id})";
try {
$name = nc_Core::get_object()->catalogue->get_by_id($site_id, "Catalogue_Name");
} catch (Exception $e) {
$name = "site{$site_id}";
}
return sprintf(NETCAT_MODULE_SEARCH_ADMIN_RULE_AREA_DESCRIPTION_SITE, $link, $name);
}