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


PHP nv_object2array函数代码示例

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


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

示例1: trigger_error

}
//Neu khong co IP
if (nv_is_banIp($client_info['ip'])) {
    trigger_error("Hi and Good-bye!!!", 256);
}
//IP Ban
if ($global_config['proxy_blocker'] != 0) {
    $client_info['is_proxy'] = $ips->nv_check_proxy();
    if (nv_is_blocker_proxy($client_info['is_proxy'], $global_config['proxy_blocker'])) {
        trigger_error('ERROR: You are behind a proxy server. Please disconnect and come again!', 256);
    }
}
//Xac dinh cac search_engine
$global_config['engine_allowed'] = array();
if (file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml')) {
    $global_config['engine_allowed'] = nv_object2array(simplexml_load_file(NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml'));
}
//Ket noi voi class xu ly request
require_once NV_ROOTDIR . '/includes/class/request.class.php';
$nv_Request = new Request($global_config, $client_info['ip']);
//Ngon ngu
$language_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/langs.ini', true);
//'name_'
require_once NV_ROOTDIR . '/includes/language.php';
require_once NV_ROOTDIR . "/language/" . NV_LANG_INTERFACE . "/global.php";
$global_config['cookie_path'] = $nv_Request->cookie_path;
//vd: /ten_thu_muc_chua_site/
$global_config['cookie_domain'] = $nv_Request->cookie_domain;
//vd: .mydomain1.com
$global_config['site_url'] = $nv_Request->site_url;
//vd: http://mydomain1.com/ten_thu_muc_chua_site
开发者ID:syphuonglam,项目名称:creative-portal,代码行数:31,代码来源:mainfile.php

示例2: nv_save_file_config_global


//.........这里部分代码省略.........
    $my_domains[] = NV_SERVER_NAME;
    $config_variable['my_domains'] = implode(',', array_unique($my_domains));
    $config_variable['check_rewrite_file'] = nv_check_rewrite_file();
    $config_variable['allow_request_mods'] = NV_ALLOW_REQUEST_MODS != '' ? NV_ALLOW_REQUEST_MODS : "request";
    $config_variable['request_default_mode'] = NV_REQUEST_DEFAULT_MODE != '' ? trim(NV_REQUEST_DEFAULT_MODE) : 'request';
    $config_variable['session_save_path'] = NV_SESSION_SAVE_PATH;
    $config_variable['log_errors_list'] = NV_LOG_ERRORS_LIST;
    $config_variable['display_errors_list'] = NV_DISPLAY_ERRORS_LIST;
    $config_variable['send_errors_list'] = NV_SEND_ERRORS_LIST;
    $config_variable['error_log_path'] = NV_LOGS_DIR . '/error_logs';
    $config_variable['error_log_filename'] = NV_ERRORLOGS_FILENAME;
    $config_variable['error_log_fileext'] = NV_LOGS_EXT;
    $config_variable['error_send_email'] = $config_variable['error_send_email'];
    $config_name_array = array('file_allowed_ext', 'forbid_extensions', 'forbid_mimes', 'allow_sitelangs', 'openid_servers', 'allow_request_mods', 'config_sso');
    if (empty($config_variable['openid_servers'])) {
        $config_variable['openid_mode'] = 0;
    }
    if ($config_variable['is_user_forum']) {
        $forum_files = @scandir(NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet');
        if (!empty($forum_files) and in_array('is_user.php', $forum_files) and in_array('changepass.php', $forum_files) and in_array('editinfo.php', $forum_files) and in_array('login.php', $forum_files) and in_array('logout.php', $forum_files) and in_array('lostpass.php', $forum_files) and in_array('register.php', $forum_files)) {
            $content_config .= "define( 'NV_IS_USER_FORUM', true );\n\n";
        } else {
            $config_variable['is_user_forum'] = 0;
        }
    }
    foreach ($config_variable as $c_config_name => $c_config_value) {
        if ($c_config_name == 'config_sso') {
            $config_sso = empty($c_config_value) ? '' : nv_var_export(unserialize($c_config_value));
            $content_config .= "\$global_config['" . $c_config_name . "']=" . $config_sso . ";\n";
        } elseif (in_array($c_config_name, $config_name_array)) {
            if (!empty($c_config_value)) {
                $c_config_value = "'" . implode("','", array_map("trim", explode(',', $c_config_value))) . "'";
            } else {
                $c_config_value = '';
            }
            $content_config .= "\$global_config['" . $c_config_name . "']=array(" . $c_config_value . ");\n";
        } else {
            if (preg_match('/^\\d+$/', $c_config_value) and $c_config_name != 'facebook_client_id') {
                $content_config .= "\$global_config['" . $c_config_name . "']=" . $c_config_value . ";\n";
            } else {
                $c_config_value = nv_unhtmlspecialchars($c_config_value);
                if (!preg_match("/^[a-z0-9\\-\\_\\.\\,\\;\\:\\@\\/\\s]+\$/i", $c_config_value) and $c_config_name != 'my_domains') {
                    $c_config_value = nv_htmlspecialchars($c_config_value);
                }
                $content_config .= "\$global_config['" . $c_config_name . "']='" . $c_config_value . "';\n";
            }
        }
    }
    $content_config .= "\$global_config['array_theme_type']=" . nv_var_export(array_filter(array_map('trim', explode(',', NV_THEME_TYPE)))) . ";\n";
    //allowed_html_tags
    if (!empty($allowed_html_tags)) {
        $allowed_html_tags = "'" . implode("','", array_map('trim', explode(',', $allowed_html_tags))) . "'";
    } else {
        $allowed_html_tags = '';
    }
    $content_config .= "\$global_config['allowed_html_tags']=array(" . $allowed_html_tags . ");\n";
    //Xac dinh cac search_engine
    $engine_allowed = file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml') ? nv_object2array(simplexml_load_file(NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml')) : array();
    $content_config .= "\$global_config['engine_allowed']=" . nv_var_export($engine_allowed) . ";\n";
    $content_config .= "\n";
    $language_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/langs.ini', true);
    $tmp_array = array();
    $lang_array_exit = nv_scandir(NV_ROOTDIR . "/language", "/^[a-z]{2}+\$/");
    foreach ($lang_array_exit as $lang) {
        $tmp_array[$lang] = $language_array[$lang];
    }
    unset($language_array);
    $content_config .= "\$language_array=" . nv_var_export($tmp_array) . ";\n";
    $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/br.ini', true);
    $content_config .= "\$nv_parse_ini_browsers=" . nv_var_export($tmp_array) . ";\n";
    $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/mobile.ini', true);
    $content_config .= "\$nv_parse_ini_mobile=" . nv_var_export($tmp_array) . ";\n";
    $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/os.ini', true);
    $content_config .= "\$nv_parse_ini_os=" . nv_var_export($tmp_array) . ";\n";
    $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/timezone.ini', true);
    $content_config .= "\$nv_parse_ini_timezone=" . nv_var_export($tmp_array) . ";\n";
    $rewrite = array();
    $global_config['rewrite_optional'] = $config_variable['rewrite_optional'];
    $global_config['rewrite_op_mod'] = $config_variable['rewrite_op_mod'];
    $global_config['rewrite_endurl'] = $config_variable['rewrite_endurl'];
    $global_config['rewrite_exturl'] = $config_variable['rewrite_exturl'];
    if ($config_variable['check_rewrite_file']) {
        require NV_ROOTDIR . '/includes/rewrite.php';
    } else {
        require NV_ROOTDIR . '/includes/rewrite_index.php';
    }
    $content_config .= "\n";
    $nv_plugin_area = array();
    $_sql = 'SELECT * FROM ' . $db_config['prefix'] . '_plugin ORDER BY plugin_area ASC, weight ASC';
    $_query = $db->query($_sql);
    while ($row = $_query->fetch()) {
        $nv_plugin_area[$row['plugin_area']][] = $row['plugin_file'];
    }
    $content_config .= "\$nv_plugin_area=" . nv_var_export($nv_plugin_area) . ";\n\n";
    $content_config .= "\$rewrite_keys=" . nv_var_export(array_keys($rewrite)) . ";\n";
    $content_config .= "\$rewrite_values=" . nv_var_export(array_values($rewrite)) . ";\n";
    $return = file_put_contents(NV_ROOTDIR . "/" . NV_DATADIR . "/config_global.php", trim($content_config), LOCK_EX);
    nv_delete_all_cache();
    return $return;
}
开发者ID:lzhao18,项目名称:nukeviet,代码行数:101,代码来源:admin_functions.php

示例3: nv_html_meta_tags

/**
 * nv_html_meta_tags()
 *
 * @param bool $html
 * @return
 */
function nv_html_meta_tags($html = true)
{
    global $global_config, $db_config, $lang_global, $key_words, $description, $module_info, $home, $client_info, $op, $page_title, $canonicalUrl, $meta_property;
    $return = array();
    $site_description = $home ? $global_config['site_description'] : (!empty($description) ? $description : (empty($module_info['description']) ? '' : $module_info['description']));
    if (empty($site_description)) {
        $ds = array();
        if (!empty($page_title)) {
            $ds[] = $page_title;
        }
        if ($op != 'main') {
            $ds[] = $module_info['funcs'][$op]['func_custom_name'];
        }
        $ds[] = $module_info['custom_title'];
        $ds[] = $client_info['selfurl'];
        $site_description = implode(' - ', $ds);
    } elseif ($site_description == 'no') {
        $site_description = '';
    }
    if (!empty($site_description)) {
        $site_description = preg_replace(array('/<[^>]*>/', '/[\\r\\n\\t]+/'), ' ', $site_description);
        $site_description = trim(preg_replace('/[ ]+/', ' ', $site_description));
        if ($global_config['description_length']) {
            $site_description = nv_clean60($site_description, $global_config['description_length'], true);
        }
        $return[] = array('name' => 'name', 'value' => 'description', 'content' => $site_description);
    }
    $kw = array();
    if (!empty($key_words)) {
        if ($key_words != 'no') {
            $kw[] = $key_words;
        }
    } elseif (!empty($module_info['keywords'])) {
        $kw[] = $module_info['keywords'];
    }
    if ($home and !empty($global_config['site_keywords'])) {
        $kw[] = $global_config['site_keywords'];
    }
    if (!empty($kw)) {
        $kw = array_unique($kw);
        $key_words = implode(',', $kw);
        $key_words = preg_replace(array("/[ ]*\\,[ ]+/", "/[\\,]+/"), array(", ", ", "), $key_words);
        $key_words = nv_strtolower(strip_tags($key_words));
        $return[] = array('name' => 'name', 'value' => 'keywords', 'content' => $key_words);
        $return[] = array('name' => 'name', 'value' => 'news_keywords', 'content' => $key_words);
    }
    $return[] = array('name' => 'http-equiv', 'value' => 'Content-Type', 'content' => "text/html; charset=" . $global_config['site_charset']);
    if ($global_config['idsite'] and file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_metatags.xml')) {
        $file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_metatags.xml';
    } else {
        $file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/metatags.xml';
    }
    if (file_exists($file_metatags)) {
        $mt = file_get_contents($file_metatags);
        $patters = array();
        $patters['/\\{CONTENT\\-LANGUAGE\\}/'] = $lang_global['Content_Language'];
        $patters['/\\{LANGUAGE\\}/'] = $lang_global['LanguageName'];
        $patters['/\\{SITE\\_NAME\\}/'] = $global_config['site_name'];
        $patters['/\\{SITE\\_EMAIL\\}/'] = $global_config['site_email'];
        $mt = preg_replace(array_keys($patters), array_values($patters), $mt);
        $mt = preg_replace('/\\{(.*)\\}/', '', $mt);
        $mt = simplexml_load_string($mt);
        $mt = nv_object2array($mt);
        if ($mt['meta_item']) {
            if (isset($mt['meta_item'][0])) {
                $metatags = $mt['meta_item'];
            } else {
                $metatags[] = $mt['meta_item'];
            }
            foreach ($metatags as $meta) {
                if (($meta['group'] == 'http-equiv' or $meta['group'] == 'name' or $meta['group'] == 'property') and preg_match('/^[a-zA-Z0-9\\-\\_\\.\\:]+$/', $meta['value']) and preg_match("/^([^\\'\"]+)\$/", (string) $meta['content'])) {
                    $return[] = array('name' => $meta['group'], 'value' => $meta['value'], 'content' => $meta['content']);
                }
            }
        }
    }
    $return[] = array('name' => 'name', 'value' => 'generator', 'content' => 'NukeViet v4.0');
    if (defined('NV_IS_ADMIN')) {
        $return[] = array('name' => 'http-equiv', 'value' => 'refresh', 'content' => $global_config['admin_check_pass_time']);
    }
    if ($global_config['current_theme_type'] == 'r') {
        $return[] = array('name' => 'name', 'value' => 'viewport', 'content' => "width=device-width, initial-scale=1");
    }
    if ($home) {
        $canonicalUrl = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $global_config['site_home_module'], true);
    } elseif (empty($canonicalUrl)) {
        $canonicalUrl = str_replace(NV_MY_DOMAIN . '/', NV_MAIN_DOMAIN . '/', $client_info['selfurl']);
    }
    if (substr($canonicalUrl, 0, 4) != 'http') {
        if (substr($canonicalUrl, 0, 1) != '/') {
            $canonicalUrl = NV_BASE_SITEURL . $canonicalUrl;
        }
        $canonicalUrl = NV_MAIN_DOMAIN . $canonicalUrl;
    }
//.........这里部分代码省略.........
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:101,代码来源:user_functions.php

示例4: die

<?php

/**
 * @Project NUKEVIET BLOG 4.x
 * @Author PHAN TAN DUNG (phantandung92@gmail.com)
 * @Copyright (C) 2014 PHAN TAN DUNG. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate Dec 11, 2013, 09:50:11 PM
 */
if (!defined('NV_BLOG_ADMIN')) {
    die('Stop!!!');
}
$BL->callFrameWorks('shadowbox');
$page_title = $BL->lang('cfgStructureData');
$array = array();
$_array_locales = nv_object2array(simplexml_load_file(NV_ROOTDIR . '/modules/' . $module_file . '/locales/locales.xml')->xpath('locale'));
$array_locales = array();
foreach ($_array_locales as $locale) {
    $array_locales[$locale['codes']['code']['standard']['representation']] = $locale['englishName'];
}
unset($_array_locales, $locale);
// Lay thong tin submit
if ($nv_Request->isset_request('submit', 'post')) {
    $array['sysGoogleAuthor'] = nv_substr($nv_Request->get_title('sysGoogleAuthor', 'post', '', 0), 0, 30);
    $array['sysFbAppID'] = nv_substr($nv_Request->get_title('sysFbAppID', 'post', '', 0), 0, 30);
    $array['sysFbAdminID'] = nv_substr($nv_Request->get_title('sysFbAdminID', 'post', '', 0), 0, 30);
    $array['sysLocale'] = nv_substr($nv_Request->get_title('sysLocale', 'post', '', 0), 0, 255);
    $array['sysDefaultImage'] = $nv_Request->get_string('sysDefaultImage', 'post', '');
    if (!preg_match("/^([0-9]+)\$/", $array['sysGoogleAuthor'])) {
        $array['sysGoogleAuthor'] = '';
    }
开发者ID:hoangvtien,项目名称:blog,代码行数:31,代码来源:config-structured-data.php

示例5: getInfo

 /**
  * Diagnostic::getInfo()
  *
  * @param mixed $time
  * @return
  */
 private function getInfo($time)
 {
     $content = array();
     $content['item'] = array();
     if (preg_match('/^localhost|127\\.0\\.0/is', $this->currentDomain)) {
         $content['item'][] = array('date' => gmdate('D, d M Y H:i:s', NV_CURRENTTIME) . ' GMT', 'PageRank' => 0, 'AlexaRank' => 0, 'AlexaBackLink' => 0, 'AlexaReach' => 0, 'GoogleBackLink' => 0, 'GoogleIndexed' => 0, 'BingBackLink' => 0, 'BingIndexed' => 0);
         return $content;
     }
     $lastProcess = 0;
     if (file_exists($this->currentCache)) {
         $content = simplexml_load_file($this->currentCache);
         $content = nv_object2array($content);
         if (!isset($content['item'][0])) {
             $content['item'] = array($content['item']);
         }
         if (!empty($time)) {
             $p = NV_CURRENTTIME - $time;
             $filemtime = @filemtime($this->currentCache);
             if ($filemtime < $p) {
                 return $this->newGetInfo($content);
             }
         }
         $lastProcess = $content['item'][sizeof($content['item']) - 1]['date'];
         $lastProcess = strtotime($lastProcess);
     }
     $currentMonth = mktime(0, 0, 0, date('m', NV_CURRENTTIME), 1, date('Y', NV_CURRENTTIME));
     if ($lastProcess < $currentMonth) {
         $content = $this->newGetInfo($content);
     }
     return $content;
 }
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:37,代码来源:diagnostic.class.php

示例6: elseif

    $error = $lang_global['error_valid_response'];
} elseif (!empty($array['error']['message'])) {
    $error = $array['error']['message'];
}
// Show error
if (!empty($error)) {
    $xtpl->assign('ERROR', $error);
    $xtpl->parse('main.error');
} elseif ($array['status'] == 'notlogin') {
    $xtpl->assign('LOGIN_NOTE', sprintf($lang_module['login_require'], NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=login&amp;redirect=' . nv_redirect_encrypt($client_info['selfurl'])));
    $xtpl->parse('main.login');
} elseif (empty($array['data'])) {
    $xtpl->parse('main.empty');
} else {
    // Save cookies
    nv_store_cookies(nv_object2array($cookies), $stored_cookies);
    foreach ($array['data'] as $row) {
        $row['rating_avg'] = ceil($row['rating_avg']);
        $row['type'] = $lang_module['types_' . intval($row['tid'])];
        $row['compatible_class'] = empty($row['compatible']) ? 'text-danger' : 'text-success';
        $row['compatible_title'] = empty($row['compatible']) ? $lang_module['incompatible'] : $lang_module['compatible'];
        if (empty($row['image_small'])) {
            $row['image_small'] = NV_BASE_SITEURL . 'themes/default/images/no_image.gif';
        }
        $row['install_link'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=install&amp;id=' . $row['id'];
        $row['detail_link'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=detail&amp;id=' . $row['id'];
        $row['detail_title'] = sprintf($lang_module['detail_title'], $row['title']);
        $xtpl->assign('ROW', $row);
        // Parse rating
        for ($i = 1; $i <= 5; $i++) {
            $xtpl->assign('STAR', $row['rating_avg'] == $i ? " active" : "");
开发者ID:nukeplus,项目名称:nuke,代码行数:31,代码来源:main.php

示例7: array

                    if (isset($userModules[$row['basename']])) {
                        continue;
                    }
                    $v = '';
                    $p = 0;
                    if (preg_match("/^([^\\s]+)\\s+([\\d]+)\$/", $row['version'], $matches)) {
                        $v = (string) $matches[1];
                        $p = (int) $matches[2];
                    }
                    $userModules[$row['basename']] = array('basename' => $row['basename'], 'version' => $v, 'mode' => isset($onlineModules[$row['basename']]['mode']) ? $onlineModules[$row['basename']]['mode'] : false, 'time' => $p, 'author' => $row['author']);
                }
            }
            $NvUpdate->module_info($onlineModules, $userModules);
        } elseif ($type == 'module') {
            $_modules = nv_getExtVersion(0);
            $_modules = nv_object2array($_modules);
            $_modules = $_modules['module'];
            $onlineModules = array();
            foreach ($_modules as $m) {
                $name = array_shift($m);
                $onlineModules[$name] = $m;
                unset($onlineModules[$name]['date']);
                $onlineModules[$name]['pubtime'] = strtotime($m['date']);
            }
            $NvUpdate->module_com_info($onlineModules);
        } else {
            die('&nbsp;');
        }
    }
    $contents = $NvUpdate->step3($array);
}
开发者ID:nukeplus,项目名称:nuke,代码行数:31,代码来源:update.php

示例8: nv_html_meta_tags

/**
 * nv_html_meta_tags()
 *
 * @return
 */
function nv_html_meta_tags()
{
    global $global_config, $lang_global, $key_words, $description, $module_info, $home, $client_info, $op, $page_title, $canonicalUrl;
    $return = "";
    if ($home) {
        $return .= "<meta name=\"description\" content=\"" . strip_tags($global_config['site_description']) . "\" />\n";
    } else {
        if (!empty($description)) {
            $return .= "<meta name=\"description\" content=\"" . strip_tags($description) . "\" />\n";
        } elseif (!empty($module_info['description'])) {
            $return .= "<meta name=\"description\" content=\"" . strip_tags($module_info['description']) . "\" />\n";
        } else {
            $ds = array();
            if (!empty($page_title)) {
                $ds[] = $page_title;
            }
            if ($op != "main") {
                $ds[] = $module_info['funcs'][$op]['func_custom_name'];
            }
            $ds[] = $module_info['custom_title'];
            $ds[] = $client_info['selfurl'];
            $return .= "<meta name=\"description\" content=\"" . strip_tags(implode(" - ", $ds)) . "\" />\n";
        }
    }
    $kw = array();
    if (!empty($key_words)) {
        $kw[] = $key_words;
    }
    if (!empty($module_info['keywords'])) {
        $kw[] = $module_info['keywords'];
    }
    if (!empty($global_config['site_keywords'])) {
        $kw[] = $global_config['site_keywords'];
    }
    if (!empty($kw)) {
        $kw = array_unique($kw);
        $kw = implode(",", $kw);
        $kw = preg_replace(array("/[ ]*\\,[ ]+/", "/[\\,]+/"), array(",", ","), $kw);
        $key_words = nv_strtolower(strip_tags($kw));
        $return .= "<meta name=\"keywords\" content=\"" . $key_words . "\" />\n";
    }
    $return .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $global_config['site_charset'] . "\" />\n";
    $file_metatags = NV_ROOTDIR . "/" . NV_DATADIR . "/metatags.xml";
    if (file_exists($file_metatags)) {
        $mt = file_get_contents($file_metatags);
        $patters = array();
        $patters['/\\{CONTENT\\-LANGUAGE\\}/'] = $lang_global['Content_Language'];
        $patters['/\\{LANGUAGE\\}/'] = $lang_global['LanguageName'];
        $patters['/\\{SITE\\_NAME\\}/'] = $global_config['site_name'];
        $patters['/\\{SITE\\_EMAIL\\}/'] = $global_config['site_email'];
        $mt = preg_replace(array_keys($patters), array_values($patters), $mt);
        $mt = preg_replace("/\\{(.*)\\}/", "", $mt);
        $mt = simplexml_load_string($mt);
        $mt = nv_object2array($mt);
        if ($mt['meta_item']) {
            if (isset($mt['meta_item'][0])) {
                $metatags = $mt['meta_item'];
            } else {
                $metatags[] = $mt['meta_item'];
            }
            foreach ($metatags as $meta) {
                if (($meta['group'] == "http-equiv" or $meta['group'] == "name") and preg_match("/^[a-zA-Z0-9\\-\\_\\.]+\$/", $meta['value']) and preg_match("/^([^\\'\"]+)\$/", (string) $meta['content'])) {
                    $return .= "<meta " . $meta['group'] . "=\"" . $meta['value'] . "\" content=\"" . $meta['content'] . "\" />\n";
                }
            }
        }
    }
    $return .= "<meta name=\"generator\" content=\"NukeViet v3.x\" />\n";
    if (defined('NV_IS_ADMIN')) {
        $return .= "<meta http-equiv=\"refresh\" content=\"" . NV_ADMIN_CHECK_PASS_TIME . "\" />\n";
    }
    if (empty($canonicalUrl)) {
        $canonicalUrl = $client_info['selfurl'];
    }
    if (substr($canonicalUrl, 0, 4) != "http") {
        if (substr($canonicalUrl, 0, 1) != "/") {
            $canonicalUrl = NV_BASE_SITEURL . $canonicalUrl;
        }
        $canonicalUrl = NV_MY_DOMAIN . $canonicalUrl;
    }
    $return .= "<link rel=\"canonical\" href=\"" . $canonicalUrl . "\" />\n";
    return $return;
}
开发者ID:atarubi,项目名称:nuke-viet,代码行数:88,代码来源:user_functions.php

示例9: Array2XML

        $array2XML = new Array2XML();
        $array2XML->saveXML($metatags, 'metatags', $file_metatags, $global_config['site_charset']);
    }
    $metaTagsOgp = (int) $nv_Request->get_bool('metaTagsOgp', 'post');
    $description_length = $nv_Request->get_int('description_length', 'post');
    $db->query("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = '" . $metaTagsOgp . "' WHERE lang = 'sys' AND module = 'site' AND config_name = 'metaTagsOgp'");
    $db->query("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = '" . $description_length . "' WHERE lang = 'sys' AND module = 'site' AND config_name = 'description_length'");
    nv_delete_all_cache(false);
    Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&rand=' . nv_genpass());
    exit;
} else {
    if (!file_exists($file_metatags)) {
        $file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/metatags.xml';
    }
    $mt = simplexml_load_file($file_metatags);
    $mt = nv_object2array($mt);
    if ($mt['meta_item']) {
        if (isset($mt['meta_item'][0])) {
            $metatags['meta'] = $mt['meta_item'];
        } else {
            $metatags['meta'][] = $mt['meta_item'];
        }
    }
}
$page_title = $lang_module['metaTagsConfig'];
$xtpl = new XTemplate('metatags.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
$xtpl->assign('NOTE', sprintf($lang_module['metaTagsNote'], implode(', ', $ignore)));
$xtpl->assign('VARS', $lang_module['metaTagsVar'] . ': ' . implode(', ', $vas));
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:31,代码来源:metatags.php

示例10: array

                $module_info['layout_funcs'] = array();
                $sth = $db->prepare('SELECT f.func_name, t.layout FROM ' . NV_MODFUNCS_TABLE . ' f
					INNER JOIN ' . NV_PREFIXLANG . '_modthemes t ON f.func_id=t.func_id
					WHERE f.in_module = :module AND t.theme= :theme');
                $sth->bindParam(':module', $module_name, PDO::PARAM_STR);
                $sth->bindParam(':theme', $global_config['module_theme'], PDO::PARAM_STR);
                $sth->execute();
                while ($row = $sth->fetch()) {
                    $module_info['layout_funcs'][$row['func_name']] = $row['layout'];
                }
                $sth->closeCursor();
                $cache = serialize($module_info['layout_funcs']);
                nv_set_cache('modules', $cache_file, $cache);
            }
            // Doc file cau hinh giao dien
            $themeConfig = nv_object2array(simplexml_load_file(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/config.ini'));
            require NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/theme.php';
            // Ket noi ngon ngu theo theme
            if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/language/' . NV_LANG_INTERFACE . '.php')) {
                require NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/language/' . NV_LANG_INTERFACE . '.php';
            } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/language/en.php')) {
                require NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/language/en.php';
            }
            // Xac dinh template module
            $module_info['template'] = $global_config['module_theme'];
            if (!file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file)) {
                if (file_exists(NV_ROOTDIR . '/themes/default/modules/' . $module_file)) {
                    $module_info['template'] = 'default';
                }
            }
            // Ket noi voi file functions.php, file chua cac function dung chung
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:31,代码来源:index.php

示例11: nv_html_meta_tags

/**
 * nv_html_meta_tags()
 *
 * @return
 */
function nv_html_meta_tags()
{
    global $global_config, $db_config, $lang_global, $key_words, $description, $module_info, $home, $client_info, $op, $page_title, $canonicalUrl, $meta_property, $id_profile_googleplus;
    $return = '';
    $site_description = $home ? $global_config['site_description'] : (!empty($description) ? $description : (empty($module_info['description']) ? '' : $module_info['description']));
    if (empty($site_description)) {
        $ds = array();
        if (!empty($page_title)) {
            $ds[] = $page_title;
        }
        if ($op != 'main') {
            $ds[] = $module_info['funcs'][$op]['func_custom_name'];
        }
        $ds[] = $module_info['custom_title'];
        $ds[] = $client_info['selfurl'];
        $site_description = implode(' - ', $ds);
    } elseif ($site_description == 'no') {
        $site_description = '';
    }
    if (!empty($site_description)) {
        $site_description = preg_replace('/<[^>]*>/', ' ', $site_description);
        // ----- remove HTML TAGs
        $site_description = str_replace("\r", '', $site_description);
        // --- replace with empty space
        $site_description = str_replace("\n", ' ', $site_description);
        // --- replace with space
        $site_description = str_replace("\t", ' ', $site_description);
        // --- replace with space
        $site_description = trim(preg_replace('/[ ]+/', ' ', $site_description));
        // ----- remove multiple spaces
        if ($global_config['description_length']) {
            $site_description = nv_clean60($site_description, $global_config['description_length'], true);
        }
        $return .= "<meta name=\"description\" content=\"" . $site_description . "\" />\n";
    }
    $kw = array();
    if (!empty($key_words)) {
        if ($key_words != 'no') {
            $kw[] = $key_words;
        }
    } elseif (!empty($module_info['keywords'])) {
        $kw[] = $module_info['keywords'];
    }
    if ($home and !empty($global_config['site_keywords'])) {
        $kw[] = $global_config['site_keywords'];
    }
    if (!empty($kw)) {
        $kw = array_unique($kw);
        $key_words = implode(',', $kw);
        $key_words = preg_replace(array("/[ ]*\\,[ ]+/", "/[\\,]+/"), array(", ", ", "), $key_words);
        $key_words = nv_strtolower(strip_tags($key_words));
        $return .= "<meta name=\"keywords\" content=\"" . $key_words . "\" />\n";
        $return .= "<meta name=\"news_keywords\" content=\"" . $key_words . "\" />\n";
    }
    $return .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $global_config['site_charset'] . "\" />\n";
    if ($global_config['idsite'] and file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_metatags.xml')) {
        $file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_metatags.xml';
    } else {
        $file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/metatags.xml';
    }
    if (file_exists($file_metatags)) {
        $mt = file_get_contents($file_metatags);
        $patters = array();
        $patters['/\\{CONTENT\\-LANGUAGE\\}/'] = $lang_global['Content_Language'];
        $patters['/\\{LANGUAGE\\}/'] = $lang_global['LanguageName'];
        $patters['/\\{SITE\\_NAME\\}/'] = $global_config['site_name'];
        $patters['/\\{SITE\\_EMAIL\\}/'] = $global_config['site_email'];
        $mt = preg_replace(array_keys($patters), array_values($patters), $mt);
        $mt = preg_replace('/\\{(.*)\\}/', '', $mt);
        $mt = simplexml_load_string($mt);
        $mt = nv_object2array($mt);
        if ($mt['meta_item']) {
            if (isset($mt['meta_item'][0])) {
                $metatags = $mt['meta_item'];
            } else {
                $metatags[] = $mt['meta_item'];
            }
            foreach ($metatags as $meta) {
                if (($meta['group'] == 'http-equiv' or $meta['group'] == 'name' or $meta['group'] == 'property') and preg_match('/^[a-zA-Z0-9\\-\\_\\.\\:]+$/', $meta['value']) and preg_match("/^([^\\'\"]+)\$/", (string) $meta['content'])) {
                    $return .= "<meta " . $meta['group'] . "=\"" . $meta['value'] . "\" content=\"" . $meta['content'] . "\" />\n";
                }
            }
        }
    }
    $return .= "<meta name=\"generator\" content=\"NukeViet v4.x\" />\n";
    if (defined('NV_IS_ADMIN')) {
        $return .= "<meta http-equiv=\"refresh\" content=\"" . $global_config['admin_check_pass_time'] . "\" />\n";
    }
    if ($home) {
        $canonicalUrl = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $global_config['site_home_module'], true);
    } elseif (empty($canonicalUrl)) {
        $canonicalUrl = str_replace(NV_MY_DOMAIN . '/', NV_MAIN_DOMAIN . '/', $client_info['selfurl']);
    }
    if (substr($canonicalUrl, 0, 4) != 'http') {
        if (substr($canonicalUrl, 0, 1) != '/') {
//.........这里部分代码省略.........
开发者ID:lzhao18,项目名称:nukeviet,代码行数:101,代码来源:user_functions.php

示例12: NukevietChange_getContents

/**
 * NukevietChange_getContents()
 *
 * @param bool $refresh
 * @return
 */
function NukevietChange_getContents($refresh = false)
{
    global $global_config;
    $url = "http://code.google.com/feeds/p/nuke-viet/svnchanges/basic";
    $xmlfile = "nukevietGoogleCode.cache";
    $load = false;
    $p = NV_CURRENTTIME - 18000;
    $p2 = NV_CURRENTTIME - 120;
    if (!file_exists(NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . $xmlfile)) {
        $load = true;
    } else {
        $filemtime = @filemtime(NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . $xmlfile);
        if ($filemtime < $p) {
            $load = true;
        } elseif ($refresh and $filemtime < $p2) {
            $load = true;
        }
    }
    if ($load) {
        include NV_ROOTDIR . '/includes/class/geturl.class.php';
        $UrlGetContents = new UrlGetContents($global_config);
        $content = $UrlGetContents->get($url);
        if (!empty($content)) {
            if (nv_function_exists('mb_convert_encoding')) {
                $content = mb_convert_encoding($content, "utf-8");
            }
            $content = simplexml_load_string($content);
            $content = nv_object2array($content);
            if (!empty($content)) {
                $code = array();
                $code['updated'] = strtotime($content['updated']);
                $code['link'] = $content['link'][0]['@attributes']['href'];
                $code['entry'] = array();
                if (isset($content['entry']) and !empty($content['entry'])) {
                    foreach ($content['entry'] as $entry) {
                        unset($matches);
                        $cont = $entry['content'];
                        preg_match_all("/(modify|add|delete)[^a-z0-9\\/\\.\\-\\_]+(\\/trunk\\/nukeviet\\/)([a-z0-9\\/\\.\\-\\_]+)/mi", $cont, $matches, PREG_SET_ORDER);
                        $cont = array();
                        if (!empty($matches)) {
                            foreach ($matches as $matche) {
                                $key = strtolower($matche[1]);
                                if (!isset($cont[$key])) {
                                    $cont[$key] = array();
                                }
                                $cont[$key][] = $matche[3];
                            }
                        }
                        unset($matches2);
                        preg_match("/Revision[\\s]+([\\d]*)[\\s]*\\:[\\s]+(.*?)/Uis", $entry['title'], $matches2);
                        $code['entry'][] = array('updated' => strtotime($entry['updated']), 'title' => $matches2[2], 'id' => $matches2[1], 'link' => $entry['link']['@attributes']['href'], 'author' => $entry['author']['name'], 'content' => $cont);
                    }
                    nv_set_cache($xmlfile, serialize($code));
                    return $code;
                }
            }
        }
    }
    $content = nv_get_cache($xmlfile);
    if (!$content) {
        return false;
    }
    $content = unserialize($content);
    return $content;
}
开发者ID:atarubi,项目名称:nuke-viet,代码行数:71,代码来源:main.php


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