Exemple #1
0
 /**
  * Flags a theme as being uninstalled.
  * @param string $name Theme code
  */
 public function setUninstalled($code)
 {
     $history = Parameters::get('system::theme.history', []);
     if (array_key_exists($code, $history)) {
         unset($history[$code]);
     }
     Parameters::set('system::theme.history', $history);
 }
Exemple #2
0
 /**
  * Index controller
  */
 public function index()
 {
     $this->vars['core_build'] = Parameters::get('system::core.build', '???');
     $this->vars['project_id'] = Parameters::get('system::project.id');
     $this->vars['project_name'] = Parameters::get('system::project.name');
     $this->vars['project_owner'] = Parameters::get('system::project.owner');
     return $this->asExtension('ListController')->index();
 }
Exemple #3
0
 /**
  * Index controller
  */
 public function index()
 {
     $this->vars['coreBuild'] = Parameters::get('system::core.build');
     $this->vars['projectId'] = Parameters::get('system::project.id');
     $this->vars['projectName'] = Parameters::get('system::project.name');
     $this->vars['projectOwner'] = Parameters::get('system::project.owner');
     $this->vars['pluginsCount'] = PluginVersion::count();
     return $this->asExtension('ListController')->index();
 }
Exemple #4
0
 /**
  * Internal helper, attaches a build code to an asset path
  * @param  array $asset Stored asset array
  * @return string
  */
 protected function getAssetEntryBuildPath($asset)
 {
     $path = $asset['path'];
     if (isset($asset['attributes']['build'])) {
         $build = $asset['attributes']['build'];
         if ($build == 'core') {
             $build = 'v' . Parameters::get('system::core.build', 1);
         } elseif ($pluginVersion = PluginVersion::getVersion($build)) {
             $build = 'v' . $pluginVersion;
         }
         $path .= '?' . $build;
     }
     return $path;
 }
 protected function getInstalledThemes()
 {
     $history = Parameters::get('system::theme.history', []);
     $manager = UpdateManager::instance();
     $installed = $manager->requestProductDetails(array_keys($history), 'theme');
     /*
      * Splice in the directory names
      */
     foreach ($installed as $key => $data) {
         $code = array_get($data, 'code');
         $installed[$key]['dirName'] = array_get($history, $code, $code);
     }
     return $installed;
 }
 /**
  * Downloads a file from the update server.
  * @param  string $uri          Gateway API URI
  * @param  string $fileCode     A unique code for saving the file.
  * @param  string $expectedHash The expected file hash of the file.
  * @param  array  $postData     Extra post data
  * @return void
  */
 public function requestServerFile($uri, $fileCode, $expectedHash, $postData = [])
 {
     $filePath = $this->getFilePath($fileCode);
     if ($projectId = Parameters::get('system::project.id')) {
         $postData['project'] = $projectId;
     }
     $result = Http::post($this->createServerUrl($uri), function ($http) use($postData, $filePath) {
         $this->applyHttpAttributes($http, $postData);
         $http->toFile($filePath);
     });
     if ($result->code != 200) {
         throw new ApplicationException(File::get($filePath));
     }
     if (md5_file($filePath) != $expectedHash) {
         @unlink($filePath);
         throw new ApplicationException(Lang::get('system::lang.server.file_corrupt'));
     }
 }
 /**
  * @see RainLab\Blog\Components\Posts::defineProperties()
  * @return array
  */
 public function defineProperties()
 {
     // check build to add fallback to not supported inspector types if needed
     $hasNewInspector = Parameters::get('system::core.build') >= 306;
     return ['searchTerm' => ['title' => 'Search Term', 'description' => 'The value to determine what the user is searching for.', 'type' => 'string', 'default' => '{{ :search }}'], 'pageNumber' => ['title' => 'rainlab.blog::lang.settings.posts_pagination', 'description' => 'rainlab.blog::lang.settings.posts_pagination_description', 'type' => 'string', 'default' => '{{ :page }}'], 'hightlight' => ['title' => 'Hightlight Matches', 'type' => 'checkbox', 'default' => false, 'showExternalParam' => false], 'postsPerPage' => ['title' => 'rainlab.blog::lang.settings.posts_per_page', 'type' => 'string', 'validationPattern' => '^[0-9]+$', 'validationMessage' => 'rainlab.blog::lang.settings.posts_per_page_validation', 'default' => '10'], 'noPostsMessage' => ['title' => 'rainlab.blog::lang.settings.posts_no_posts', 'description' => 'rainlab.blog::lang.settings.posts_no_posts_description', 'type' => 'string', 'default' => 'No posts found', 'showExternalParam' => false], 'sortOrder' => ['title' => 'rainlab.blog::lang.settings.posts_order', 'description' => 'rainlab.blog::lang.settings.posts_order_description', 'type' => 'dropdown', 'default' => 'published_at desc'], 'excludeCategories' => ['title' => 'Exclude Categories', 'description' => 'Posts with selected categories are excluded from the search result', 'type' => $hasNewInspector ? 'set' : 'dropdown'], 'categoryPage' => ['title' => 'rainlab.blog::lang.settings.posts_category', 'description' => 'rainlab.blog::lang.settings.posts_category_description', 'type' => 'dropdown', 'default' => 'blog/category', 'group' => 'Links'], 'postPage' => ['title' => 'rainlab.blog::lang.settings.posts_post', 'description' => 'rainlab.blog::lang.settings.posts_post_description', 'type' => 'dropdown', 'default' => 'blog/post', 'group' => 'Links']];
 }
Exemple #8
0
 protected function loadBuildNum()
 {
     $this->build = Parameters::get('system::core.build');
 }