Пример #1
0
 /**
  * Get raw structure in json and organize it to proper output for ElggBatch results
  * @param mixed $data
  * @return stdClass|boolean
  */
 private static function handlePluginProjectsRssResult($data)
 {
     $data = simplexml_load_string($data);
     if ($data === false) {
         throw new IOException("Invalid XML structure received!");
     }
     // 		var_dump($data->getDocNamespaces(), $data->getNamespaces());
     $channel = $data->xpath('channel/item');
     if (is_array($channel)) {
         $result = array();
         foreach ($channel as $item) {
             // 				var_dump($item->saveXML());
             $ent = new ElggRemotePluginProject();
             $ent->loadFromRss($item);
             $result[] = $ent;
             // 				$result[] = (object)array(
             // 					'title' => (string)$item->title,
             // 					'description' => (string)$item->description,
             // 					'rssGuid' => (string)$item->guid,
             // 					'rssLink' => (string)$item->link,
             // 					'updatedTs' => strtotime($item->pubDate),
             // 				);
         }
         return $result;
     }
     return false;
 }
Пример #2
0
<?php

$guid = get_input('guid');
$version = get_input('version');
$root = get_input('root');
try {
    $entity = ElggRemotePluginProject::getByPackage($guid, $version);
    if ($entity instanceof ElggRemotePluginProject) {
        $entity->install($version, $root);
        system_message(elgg_echo('action:plugin:install:ok'));
    } else {
        //invalid param
        register_error(elgg_echo('action:plugin:install:error:param'));
    }
} catch (Exception $e) {
    register_error($e->getMessage());
}
forward(REFERER);