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


PHP Piwik_Common::createHtAccess方法代码示例

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


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

示例1: createHtAccessFiles

 /**
  * Generate Apache .htaccess files to restrict access
  */
 public static function createHtAccessFiles()
 {
     // deny access to these folders
     $directoriesToProtect = array('/config', '/core', '/lang', '/tmp');
     foreach ($directoriesToProtect as $directoryToProtect) {
         Piwik_Common::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect);
     }
     // more selective allow/deny filters
     $allowAny = "<Files \"*\">\nAllow from all\nSatisfy any\n</Files>\n";
     $allowStaticAssets = "<Files ~ \"\\.(test\\.php|gif|ico|jpg|png|js|css|swf)\$\">\nSatisfy any\nAllow from all\n</Files>\n";
     $denyDirectPhp = "<Files ~ \"\\.(php|php4|php5|inc|tpl|in)\$\">\nDeny from all\n</Files>\n";
     $directoriesToProtect = array('/js' => $allowAny, '/libs' => $denyDirectPhp . $allowStaticAssets, '/plugins' => $denyDirectPhp . $allowStaticAssets, '/themes' => $denyDirectPhp . $allowStaticAssets);
     foreach ($directoriesToProtect as $directoryToProtect => $content) {
         Piwik_Common::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect, $content);
     }
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:19,代码来源:Piwik.php

示例2: createHtAccessFiles

 /**
  * Generate Apache .htaccess files to restrict access
  */
 public static function createHtAccessFiles()
 {
     // deny access to these folders
     $directoriesToProtect = array('/config', '/core', '/lang', '/tmp');
     foreach ($directoriesToProtect as $directoryToProtect) {
         Piwik_Common::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect, $overwrite = true);
     }
     // Allow/Deny lives in different modules depending on the Apache version
     $allow = "<IfModule mod_access.c>\nAllow from all\n</IfModule>\n<IfModule !mod_access_compat>\n<IfModule mod_authz_host.c>\nAllow from all\n</IfModule>\n</IfModule>\n<IfModule mod_access_compat>\nAllow from all\n</IfModule>\n";
     $deny = "<IfModule mod_access.c>\nDeny from all\n</IfModule>\n<IfModule !mod_access_compat>\n<IfModule mod_authz_host.c>\nDeny from all\n</IfModule>\n</IfModule>\n<IfModule mod_access_compat>\nDeny from all\n</IfModule>\n";
     // more selective allow/deny filters
     $allowAny = "<Files \"*\">\n" . $allow . "Satisfy any\n</Files>\n";
     $allowStaticAssets = "<Files ~ \"\\.(test\\.php|gif|ico|jpg|png|js|css|swf)\$\">\n" . $allow . "Satisfy any\n</Files>\n";
     $denyDirectPhp = "<Files ~ \"\\.(php|php4|php5|inc|tpl|in)\$\">\n" . $deny . "</Files>\n";
     $directoriesToProtect = array('/js' => $allowAny, '/libs' => $denyDirectPhp . $allowStaticAssets, '/plugins' => $denyDirectPhp . $allowStaticAssets, '/themes' => $denyDirectPhp . $allowStaticAssets);
     foreach ($directoriesToProtect as $directoryToProtect => $content) {
         Piwik_Common::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect, $overwrite = true, $content);
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:22,代码来源:Piwik.php


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