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


PHP Stylesheet::stylesVersionIncrement方法代码示例

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


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

示例1: main

 /**
  * Themes plugin admin
  */
 public static function main()
 {
     // Get current themes
     $current_site_theme = Option::get('theme_site_name');
     $current_admin_theme = Option::get('theme_admin_name');
     // Init vars
     $themes_site = Themes::getSiteThemes();
     $themes_admin = Themes::getAdminThemes();
     $templates = Themes::getTemplates();
     $chunks = Themes::getChunks();
     $styles = Themes::getStyles();
     $scripts = Themes::getScripts();
     $errors = array();
     $chunk_path = THEMES_SITE . DS . $current_site_theme . DS;
     $template_path = THEMES_SITE . DS . $current_site_theme . DS;
     $style_path = THEMES_SITE . DS . $current_site_theme . DS . 'css' . DS;
     $script_path = THEMES_SITE . DS . $current_site_theme . DS . 'js' . DS;
     // Save site theme
     if (Request::post('save_site_theme')) {
         if (Security::check(Request::post('csrf'))) {
             Option::update('theme_site_name', Request::post('themes'));
             // Clean Monstra TMP folder.
             Monstra::cleanTmp();
             // Increment Styles and Javascript version
             Stylesheet::stylesVersionIncrement();
             Javascript::javascriptVersionIncrement();
             Request::redirect('index.php?id=themes');
         } else {
             die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
         }
     }
     // Save site theme
     if (Request::post('save_admin_theme')) {
         if (Security::check(Request::post('csrf'))) {
             Option::update('theme_admin_name', Request::post('themes'));
             // Clean Monstra TMP folder.
             Monstra::cleanTmp();
             Request::redirect('index.php?id=themes');
         } else {
             die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
         }
     }
     // Its mean that you can add your own actions for this plugin
     Action::run('admin_themes_extra_actions');
     // Check for get actions
     // -------------------------------------
     if (Request::get('action')) {
         // Switch actions
         // -------------------------------------
         switch (Request::get('action')) {
             // Add chunk
             // -------------------------------------
             case "add_chunk":
                 if (Request::post('add_file') || Request::post('add_file_and_exit')) {
                     if (Security::check(Request::post('csrf'))) {
                         if (trim(Request::post('name')) == '') {
                             $errors['file_empty_name'] = __('Required field', 'themes');
                         }
                         if (file_exists($chunk_path . Security::safeName(Request::post('name'), null, false) . '.chunk.php')) {
                             $errors['file_exists'] = __('This chunk already exists', 'themes');
                         }
                         if (count($errors) == 0) {
                             // Save chunk
                             File::setContent($chunk_path . Security::safeName(Request::post('name'), null, false) . '.chunk.php', Request::post('content'));
                             Notification::set('success', __('Your changes to the chunk <i>:name</i> have been saved.', 'themes', array(':name' => Security::safeName(Request::post('name'), null, false))));
                             if (Request::post('add_file_and_exit')) {
                                 Request::redirect('index.php?id=themes');
                             } else {
                                 Request::redirect('index.php?id=themes&action=edit_chunk&filename=' . Security::safeName(Request::post('name'), null, false));
                             }
                         }
                     } else {
                         die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
                     }
                 }
                 // Save fields
                 if (Request::post('name')) {
                     $name = Request::post('name');
                 } else {
                     $name = '';
                 }
                 if (Request::post('content')) {
                     $content = Request::post('content');
                 } else {
                     $content = '';
                 }
                 // Display view
                 View::factory('box/themes/views/backend/add')->assign('name', $name)->assign('content', $content)->assign('errors', $errors)->assign('action', 'chunk')->display();
                 break;
                 // Add template
                 // -------------------------------------
             // Add template
             // -------------------------------------
             case "add_template":
                 if (Request::post('add_file') || Request::post('add_file_and_exit')) {
                     if (Security::check(Request::post('csrf'))) {
                         if (trim(Request::post('name')) == '') {
//.........这里部分代码省略.........
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:101,代码来源:themes.admin.php

示例2: main

 /**
  * Plugins admin
  */
 public static function main()
 {
     // Get siteurl
     $site_url = Option::get('siteurl');
     // Get installed plugin from $plugins array
     $installed_plugins = Plugin::$plugins;
     // Get installed users plugins
     $_users_plugins = array();
     foreach (Plugin::$plugins as $plugin) {
         if ($plugin['privilege'] !== 'box') {
             $_users_plugins[] = $plugin['id'];
         }
     }
     // Get plugins table
     $plugins = new Table('plugins');
     // Delete plugin
     // -------------------------------------
     if (Request::get('delete_plugin')) {
         if (Security::check(Request::get('token'))) {
             // Nobody cant remove box plugins
             if ($installed_plugins[Text::lowercase(str_replace("Plugin", "", Request::get('delete_plugin')))]['privilege'] !== 'box') {
                 // Run plugin uninstaller file
                 $plugin_name = Request::get('delete_plugin');
                 if (File::exists(PLUGINS . DS . $plugin_name . DS . 'install' . DS . $plugin_name . '.uninstall.php')) {
                     include PLUGINS . DS . $plugin_name . DS . 'install' . DS . $plugin_name . '.uninstall.php';
                 }
                 // Clean Monstra TMP folder.
                 Monstra::cleanTmp();
                 // Increment Styles and Javascript version
                 Stylesheet::stylesVersionIncrement();
                 Javascript::javascriptVersionIncrement();
                 // Delete plugin form plugins table
                 $plugins->deleteWhere('[name="' . Request::get('delete_plugin') . '"]');
                 // Redirect
                 Request::redirect('index.php?id=plugins');
             }
         } else {
             die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
         }
     }
     // Install new plugin
     // -------------------------------------
     if (Request::get('install')) {
         if (Security::check(Request::get('token'))) {
             // Load plugin install xml file
             $plugin_xml = XML::loadFile(PLUGINS . DS . basename(Text::lowercase(Request::get('install')), '.manifest.xml') . DS . 'install' . DS . Request::get('install'));
             // Add plugin to plugins table
             $plugins->insert(array('name' => basename(Request::get('install'), '.manifest.xml'), 'location' => (string) $plugin_xml->plugin_location, 'status' => (string) $plugin_xml->plugin_status, 'priority' => (int) $plugin_xml->plugin_priority));
             // Clean Monstra TMP folder.
             Monstra::cleanTmp();
             Stylesheet::stylesVersionIncrement();
             Javascript::javascriptVersionIncrement();
             // Run plugin installer file
             $plugin_name = str_replace(array("Plugin", ".manifest.xml"), "", Request::get('install'));
             if (File::exists(PLUGINS . DS . basename(Text::lowercase(Request::get('install')), '.manifest.xml') . DS . 'install' . DS . $plugin_name . '.install.php')) {
                 include PLUGINS . DS . basename(Text::lowercase(Request::get('install')), '.manifest.xml') . DS . 'install' . DS . $plugin_name . '.install.php';
             }
             Request::redirect('index.php?id=plugins');
         } else {
             die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
         }
     }
     // Delete plugin from server
     // -------------------------------------
     if (Request::get('delete_plugin_from_server')) {
         if (Security::check(Request::get('token'))) {
             // Clean Monstra TMP folder.
             Monstra::cleanTmp();
             Stylesheet::stylesVersionIncrement();
             Javascript::javascriptVersionIncrement();
             Dir::delete(PLUGINS . DS . basename(Request::get('delete_plugin_from_server'), '.manifest.xml'));
             Request::redirect('index.php?id=plugins');
         } else {
             die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
         }
     }
     // Upload & extract plugin archive
     // -------------------------------------
     if (Request::post('upload_file')) {
         if (Security::check(Request::post('csrf'))) {
             if ($_FILES['file']) {
                 if (in_array(File::ext($_FILES['file']['name']), array('zip'))) {
                     $tmp_dir = ROOT . DS . 'tmp' . DS . uniqid('plugin_');
                     $error = 'Plugin was not uploaded';
                     if (Dir::create($tmp_dir)) {
                         $file_locations = Zip::factory()->extract($_FILES['file']['tmp_name'], $tmp_dir);
                         if (!empty($file_locations)) {
                             $manifest = '';
                             foreach ($file_locations as $filepath) {
                                 if (substr($filepath, -strlen('.manifest.xml')) === '.manifest.xml') {
                                     $manifest = $filepath;
                                     break;
                                 }
                             }
                             if (!empty($manifest) && basename(dirname($manifest)) === 'install') {
                                 $manifest_file = pathinfo($manifest, PATHINFO_BASENAME);
                                 $plugin_name = str_replace('.manifest.xml', '', $manifest_file);
//.........这里部分代码省略.........
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:101,代码来源:plugins.admin.php


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