예제 #1
0
파일: shortcodes.php 프로젝트: eigentor/sbl
 /**
  * Process a shortcode.
  *
  * @param string $shortcodeName
  * @param boolean $lowLevel
  * @param array $atts
  * @param string $content
  * @return string
  */
 private static function runShortcode($shortcodeName, $lowLevel, $atts, $content)
 {
     // The content of low-level shortcodes is supposed to have been saved in `self::$lowLevelShortcodeContent`.
     if ($lowLevel && isset($content) && isset(self::$lowLevelShortcodeContent[$content])) {
         $content = self::$lowLevelShortcodeContent[$content];
     }
     // Print the shortcode.
     $model = RPBChessboardHelperLoader::loadModel('Shortcode/' . $shortcodeName, $atts, $content);
     return RPBChessboardHelperLoader::printTemplateOffScreen('Shortcode/' . $shortcodeName, $model);
 }
예제 #2
0
파일: cache.php 프로젝트: eigentor/sbl
 /**
  * Write a file into the cache. Nothing happens if the file already exists.
  *
  * @param string $fileName File name, relative to the cache root.
  * @param string $templateName Template to use to generate the file, if necessary.
  * @param string $modelName Model to use to generate the file, if necessary.
  */
 public static function ensureExists($fileName, $templateName, $modelName)
 {
     $fullFileName = self::getFullFileName($fileName);
     if (file_exists($fullFileName)) {
         return;
     }
     $model = RPBChessboardHelperLoader::loadModel($modelName);
     $text = RPBChessboardHelperLoader::printTemplateOffScreen($templateName, $model);
     $dirName = dirname($fullFileName);
     if (!file_exists($dirName)) {
         mkdir($dirName, 0777, true);
     }
     file_put_contents($fullFileName, $text);
     update_option('rpbchessboard_cache_' . $fileName, uniqid());
 }
예제 #3
0
파일: scripts.php 프로젝트: eigentor/sbl
 public static function callbackInlinedScripts()
 {
     $model = RPBChessboardHelperLoader::loadModel('Common/Compatibility');
     RPBChessboardHelperLoader::printTemplate('Localization', $model);
 }
예제 #4
0
파일: adminpages.php 프로젝트: eigentor/sbl
 /**
  * Load the model `$postModelName`, and execute the method `$methodName` supposingly defined by this model.
  *
  * @param object $model
  * @param string $postModelName
  * @param string $methodName
  * @param string $capability Required capability to execute the action. Default is `'manage_options'`.
  */
 private static function executeAction($model, $postModelName, $methodName, $capability = 'manage_options')
 {
     if (!current_user_can($capability)) {
         return;
     }
     $postModel = RPBChessboardHelperLoader::loadModel('Post/' . $postModelName);
     $model->setPostMessage($postModel->{$methodName}());
 }