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


PHP theme::list_available方法代码示例

本文整理汇总了PHP中theme::list_available方法的典型用法代码示例。如果您正苦于以下问题:PHP theme::list_available方法的具体用法?PHP theme::list_available怎么用?PHP theme::list_available使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在theme的用法示例。


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

示例1: latest_available

 public static function latest_available()
 {
     $list = theme::list_available();
     $post = array();
     if (!is_array($list)) {
         return false;
     }
     foreach ($list as $theme) {
         $post[$theme['code']] = $theme['version'];
     }
     $latest_update = core_curl_post('http://update.navigatecms.com/themes', array('themes' => json_encode($post)));
     if (empty($latest_update)) {
         return false;
     }
     $latest_update = json_decode($latest_update, true);
     return $latest_update;
 }
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:17,代码来源:theme.class.php

示例2: run

function run()
{
    global $user;
    global $layout;
    global $website;
    global $theme;
    global $DB;
    $out = '';
    switch ($_REQUEST['act']) {
        case 'theme_info':
            echo '<iframe src="' . NAVIGATE_URL . '/themes/' . $_REQUEST['theme'] . '/' . $_REQUEST['theme'] . '.info.html' . '" scrolling="auto" frameborder="0"  width="100%" height="100%"></iframe>';
            core_terminate();
            break;
        case 'remove':
            // check the theme is not actually used in any website
            $usages = $DB->query_single('COUNT(*)', 'nv_websites', ' theme = ' . protect($_REQUEST['theme']));
            if ($usages == 0) {
                try {
                    $theme = new theme();
                    $theme->load($_REQUEST['theme']);
                    $status = $theme->delete();
                    echo json_encode($status);
                } catch (Exception $e) {
                    echo $e->getMessage();
                }
            } else {
                $status = t(537, "Can't remove the theme because it is currently being used by another website.");
                echo $status;
            }
            core_terminate();
            break;
            /*
            case 'export':
                $out = themes_export_form();
                break;
            */
        /*
        case 'export':
            $out = themes_export_form();
            break;
        */
        case 'theme_sample_content_import':
            try {
                $theme->import_sample();
                $layout->navigate_notification(t(374, "Item installed successfully."), false);
            } catch (Exception $e) {
                $layout->navigate_notification($e->getMessage(), true, true);
            }
            $themes = theme::list_available();
            $out = themes_grid($themes);
            break;
        case 'theme_sample_content_export':
            if (empty($_POST)) {
                $out = themes_sample_content_export_form();
            } else {
                $categories = explode(',', $_POST['categories']);
                $folder = $_POST['folder'];
                $items = explode(',', $_POST['elements']);
                $block_groups = explode(',', $_POST['block_groups']);
                $blocks = explode(',', $_POST['blocks']);
                $comments = explode(',', $_POST['comments']);
                theme::export_sample($categories, $items, $block_groups, $blocks, $comments, $folder);
                core_terminate();
            }
            break;
        case 'install_from_hash':
            $url = base64_decode($_GET['hash']);
            if (!empty($url) && $user->permission("themes.install") == "true") {
                $error = false;
                parse_str(parse_url($url, PHP_URL_QUERY), $query);
                $tmp_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $query['code'] . '.zip';
                @core_file_curl($url, $tmp_file);
                if (@filesize($tmp_file) == 0) {
                    @unlink($tmp_file);
                    // core file curl failed, try using file_get_contents...
                    $tmp = @file_get_contents($url);
                    if (!empty($tmp)) {
                        @file_put_contents($tmp_file, $tmp);
                    }
                    unset($tmp);
                }
                if (@filesize($tmp_file) > 0) {
                    // uncompress ZIP and copy it to the themes dir
                    @mkdir(NAVIGATE_PATH . '/themes/' . $query['code']);
                    $zip = new ZipArchive();
                    $zip_open_status = $zip->open($tmp_file);
                    if ($zip_open_status === TRUE) {
                        $zip->extractTo(NAVIGATE_PATH . '/themes/' . $query['code']);
                        $zip->close();
                        $layout->navigate_notification(t(374, "Item installed successfully."), false);
                    } else {
                        $layout->navigate_notification('ERROR ' . $zip_open_status, true, true);
                        $error = true;
                    }
                } else {
                    $layout->navigate_notification(t(56, 'Unexpected error'), true, true);
                    $error = true;
                }
                if ($error) {
                    $layout->add_content('
//.........这里部分代码省略.........
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:101,代码来源:themes.php


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