Permalink
Browse files

Merge branch 'namespace' of github.com:bueltge/WordPress-Basis-Theme …

…into namespace
  • Loading branch information...
bueltge committed Jun 12, 2012
2 parents a413e08 + 24814b9 commit 776210a430edc2305f86456f22a4c7ad1b8d4aee
Showing with 8,009 additions and 3,155 deletions.
  1. +6 −0 .gitignore
  2. +215 −0 classes/class-apc_cache.php
  3. +219 −0 classes/class-hooks.php
  4. +167 −0 classes/class-loader.php
  5. +88 −0 classes/class-scripts.php
  6. +48 −0 classes/class-styles.php
  7. +170 −0 classes/class-templates.php
  8. +26 −0 classes/comments/class-comments.php
  9. +3 −0 classes/comments/index.php
  10. +3 −0 classes/content/index.php
  11. +42 −0 classes/custom-login/class-login_style.php
  12. +3 −0 classes/custom-login/index.php
  13. +112 −0 classes/exif/class-exif.php
  14. +3 −0 classes/exif/index.php
  15. +70 −0 classes/helpers/class-helper.php
  16. +3 −0 classes/helpers/index.php
  17. +3 −0 classes/index.php
  18. +604 −0 classes/options/class-theme_options.php
  19. +3 −0 classes/options/index.php
  20. +35 −0 classes/rights/class-capabilities.php
  21. +3 −0 classes/rights/index.php
  22. +36 −0 classes/sidebars/class-default_sidebars.php
  23. +3 −0 classes/sidebars/index.php
  24. +1,134 −0 classes/tmp/exifer-tmp/exif.php
  25. 0 classes/tmp/exifer-tmp/index.html
  26. +17 −0 classes/tmp/exifer-tmp/index.php
  27. +426 −0 classes/tmp/exifer-tmp/makers/canon.php
  28. +1,134 −0 classes/tmp/exifer-tmp/makers/exif.php
  29. +247 −0 classes/tmp/exifer-tmp/makers/fujifilm.php
  30. +218 −0 classes/tmp/exifer-tmp/makers/gps.php
  31. +411 −0 classes/tmp/exifer-tmp/makers/nikon.php
  32. +189 −0 classes/tmp/exifer-tmp/makers/olympus.php
  33. +292 −0 classes/tmp/exifer-tmp/makers/panasonic.php
  34. +158 −0 classes/tmp/exifer-tmp/makers/sanyo.php
  35. +115 −0 classes/tmp/fb_categories_widget.php
  36. +291 −0 classes/tmp/grab_exif_data.php
  37. +54 −0 classes/tmp/grab_exif_data_from_wp.php
  38. +33 −0 classes/widgets/class-widgets.php
  39. +3 −0 classes/widgets/index.php
  40. +123 −0 classes/widgets/widget.last_img.php
  41. +61 −101 comments.php
  42. +10 −0 css/admin-theme-options.css
  43. +1 −0 css/core.css
  44. +3 −0 css/dark.css
  45. +30 −0 css/editor-style.css
  46. +3 −0 css/index.php
  47. +3 −0 css/light.css
  48. +11 −0 css/login_style.css
  49. +179 −179 {layout → }/css/normalize.css
  50. +0 −83 custom-login/custom-login.css
  51. +11 −16 footer.php
  52. +62 −316 functions.php
  53. +36 −51 header.php
  54. BIN images/favicon.ico
  55. +3 −0 images/index.php
  56. BIN images/loading.gif
  57. BIN images/logo.png
  58. BIN images/wordpress-icon.png
  59. +198 −0 inc/admin/class-branding.php
  60. +46 −0 inc/admin/readme.md
  61. BIN inc/class-core.php
  62. +57 −0 inc/class-i18n.php
  63. +80 −0 inc/comments/comment.php
  64. +2 −0 inc/index.php
  65. +44 −0 inc/setup.php
  66. 0 index.html
  67. +41 −67 index.php
  68. +0 −4 js/DOMAssistantCompressed-2.7.4.js
  69. +35 −0 js/admin-theme-options.js
  70. +0 −4 js/html5.js
  71. +0 −10 js/ie-css3.js
  72. +3 −0 js/index.php
  73. +0 −13 js/modernizr-1.1.min.js
  74. +0 −343 js/quicktags.js
  75. BIN languages/Sie_fr_FR.mo
  76. +0 −348 languages/Sie_fr_FR.po
  77. BIN languages/du_fr_FR.mo
  78. +0 −349 languages/du_fr_FR.po
  79. BIN languages/en_US.mo
  80. +0 −323 languages/en_US.po
  81. +3 −0 languages/index.php
  82. +0 −66 layout/css/hardboiledmediaqueries.0.9.css
  83. +0 −13 layout/css/html5.css
  84. +0 −103 layout/css/reset/html5-reset-1.4.css
  85. +0 −62 layout/css/reset/reset.css
  86. +0 −126 layout/css/style.css
  87. +0 −451 layout/example/style.css
  88. +0 −37 layout/html5areas/html5areas.css
  89. +60 −0 page.php
  90. +50 −0 parts/content.php
  91. +26 −0 parts/no-results.php
  92. +3 −0 plugins/index.php
  93. BIN screenshot.png
  94. +82 −0 search.php
  95. +10 −7 searchform.php
  96. +44 −47 sidebar.php
  97. +49 −23 single.php
  98. +14 −13 style.css
  99. +39 −0 widgets/init.php
View
@@ -0,0 +1,6 @@
.settings
*.aptana.*
.project
.svn
*.svn
.DS_Store
View
@@ -0,0 +1,215 @@
<?php
/**
* @package WordPress
* @subpackage WP-Basis Theme
* @template class for use APC cache in WP
* @since 0.0.1
*/
/*
* How to use it
* <?php
* require 'class.apc_cache.php';
* $cache = new Wp_Basis_Apc_Cache();
* $cache -> capturePage();
*
* // Here goes the rest of your code :)
*
*/
class Wp_Basis_Apc_Cache {
/**
* The default time-to-live value, 5 seconds.
*/
protected $_ttl = 5;
/**
* The random factor value.
* Increment this value if you expect random page results.
*/
protected $_randomFactor = 0;
/**
* Cache stack.
*/
protected $_stack = array();
public function __construct() {
if (!extension_loaded('apc'))
throw new Exception('APC extension is not loaded!');
}
/**
* Set time-to-live value. The bigger the value the bigger time interval
* between page refreshes.
* @param int $ttl
*/
public function setTtl($ttl) {
$this -> _ttl = $ttl;
}
/**
* Get time-to-live value.
* @return int
*/
public function getTtl() {
return $this -> _ttl;
}
/**
* Set random factor, the bigger the value the more pages will be cached.
* Use this if you expect random page results.
* @param int $randomFactor
*/
public function setRandomFactor($randomFactor) {
$this -> _randomFactor = $randomFactor;
}
/**
* Get random factor.
* @param int $randomFactor
*/
public function getRandomFactor($randomFactor) {
return $this -> _randomFactor;
}
/**
* Save data to cache.
* @param string $cacheId
* @param mixed $data
* @return boolean
*/
public function save($cacheId, $data) {
return apc_store($cacheId, $data, $this -> _ttl);
}
/**
* Load data from cache.
* @param string $cacheId
* @return mixed
*/
public function load($cacheId) {
$success = false;
$data = apc_fetch($cacheId, $success);
return ($success ? $data : null);
}
/**
* Remove cache.
* @param string $cacheId
* @return boolean
*/
public function remove($cacheId) {
return apc_delete($cacheId);
}
/**
* Start capturing the output.
*
* If more than one request will try to capture the output in the same time,
* the first one should lock a mutex and the other will wait up to 5 seconds
* before unlock or die.
*
* @param string $cacheId
*/
public function capture($cacheId) {
if ($this -> _randomFactor > 0)
$cacheId .= (rand() % $this -> _randomFactor);
$this -> _loadCacheAndExit($cacheId);
$this -> _waitForLockOrDie($cacheId);
$this -> _loadCacheAndExit($cacheId);
$this -> save($cacheId . 'lock', true);
ob_start(array($this, '_flush'));
ob_implicit_flush(false);
array_push($this -> _stack, $cacheId);
}
/**
* Flush output and save it in cache when a request is finished.
* This method is being used by output buffering feature in php.
* @param string $data
* @return string
*/
public function _flush($data) {
$cacheId = array_pop($this -> _stack);
$this -> save($cacheId, $data);
$this -> remove($cacheId . 'lock');
return $data;
}
/**
* Start capturing the page output.
* Generate an unique cache id based on the current request uri,
* get and post arrays.
* If more than one request will try to capture the output in the same time,
* the first one should lock a mutex and the other will wait up to 5 seconds
* before unlock or die.
*/
public function capturePage() {
$cacheId = md5(serialize(array($_SERVER['REQUEST_URI'], $_GET, $_POST)));
if ($this -> _randomFactor > 0)
$cacheId .= (rand() % $this -> _randomFactor);
$this -> _loadPageCacheAndExit($cacheId);
$this -> _waitForLockOrDie($cacheId);
$this -> _loadPageCacheAndExit($cacheId);
$this -> save($cacheId . 'lock', true);
ob_start(array($this, '_flushPage'));
ob_implicit_flush(false);
array_push($this -> _stack, $cacheId);
}
/**
* Flush output and save it in cache when a request is finished.
* This method is being used by output buffering feature in php.
*
* This method remembers sent headers.
*
* @param string $data
* @return string
*/
public function _flushPage($data) {
$cacheId = array_pop($this -> _stack);
$this -> save($cacheId, array($data, headers_list()));
$this -> remove($cacheId . 'lock');
return $data;
}
/**
* Load and flush cache.
* @param string $cacheId
*/
protected function _loadCacheAndExit($cacheId) {
$data = $this -> load($cacheId);
if ($data !== null) {
echo $data;
exit ;
}
}
/**
* Load page cache, restore headers and flush response.
* @param string $cacheId
*/
protected function _loadPageCacheAndExit($cacheId) {
$pack = $this -> load($cacheId);
if (is_array($pack)) {
$headers = $pack[1];
foreach ($headers as $header)
header($header);
echo $pack[0];
exit ;
}
}
/**
* Wait up to 5 seconds for unlock or die.
* @param string $cacheId
*/
protected function _waitForLockOrDie($cacheId) {
$cacheId .= 'lock';
$i = 500;
while ($i > 0) {
if (!$this -> load($cacheId))
return;
$i--;
usleep(10000);
}
exit();
}
}
Oops, something went wrong.

0 comments on commit 776210a

Please sign in to comment.