mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 22:43:19 +00:00
Add use of core serializer
This commit is contained in:
@@ -56,7 +56,7 @@ class Edit implements ControllerProviderInterface
|
||||
|
||||
try
|
||||
{
|
||||
$VC = \databox_Field_VocabularyControl::get($vocabulary);
|
||||
$VC = \Alchemy\Phrasea\Vocabulary\Controller::get($vocabulary);
|
||||
$databox = \databox::get_instance($sbas_id);
|
||||
}
|
||||
catch(\Exception $e)
|
||||
|
@@ -83,7 +83,13 @@ class Feed implements ControllerProviderInterface
|
||||
$datas = array('error' => true, 'message' => _('An error occured'), 'details' => $e->getMessage());
|
||||
}
|
||||
|
||||
return new Response(\p4string::jsonencode($datas), 200, array('Content-Type' => 'application/json'));
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
, 200
|
||||
, array('Content-Type' => 'application/json')
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -164,7 +170,13 @@ class Feed implements ControllerProviderInterface
|
||||
$datas['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
return new Response(\p4string::jsonencode($datas), 200, array('Content-Type' => 'application/json'));
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
, 200
|
||||
, array('Content-Type' => 'application/json')
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -201,7 +213,13 @@ class Feed implements ControllerProviderInterface
|
||||
$datas['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
return new Response(\p4string::jsonencode($datas), 200, array('Content-Type' => 'application/json'));
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
, 200
|
||||
, array('Content-Type' => 'application/json')
|
||||
);
|
||||
});
|
||||
|
||||
//$app->post('/entry/{id}/addelement/', function($id) use ($app, $appbox, $twig)
|
||||
@@ -271,16 +289,20 @@ class Feed implements ControllerProviderInterface
|
||||
$registry = $appbox->get_registry();
|
||||
|
||||
|
||||
$output = \p4string::jsonencode(
|
||||
array(
|
||||
$output = array(
|
||||
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
|
||||
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
|
||||
<div><input type="text" readonly="readonly" class="input_select_copy" value="' . $feeds->get_aggregate()->get_user_link($registry, $user, \Feed_Adapter::FORMAT_RSS, null, $renew)->get_href() . '"/></div>',
|
||||
'titre' => _('publications::votre rss personnel')
|
||||
)
|
||||
);
|
||||
|
||||
return new Response($output, 200, array('Content-Type' => 'application/json'));
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($output, 'json')
|
||||
, 200
|
||||
, array('Content-Type' => 'application/json')
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -291,16 +313,20 @@ class Feed implements ControllerProviderInterface
|
||||
$feed = \Feed_Adapter::load_with_user($appbox, $user, $id);
|
||||
$registry = $appbox->get_registry();
|
||||
|
||||
$output = \p4string::jsonencode(
|
||||
array(
|
||||
$output = array(
|
||||
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
|
||||
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
|
||||
<div><input type="text" style="width:100%" value="' . $feed->get_user_link($registry, $user, \Feed_Adapter::FORMAT_RSS, null, $renew)->get_href() . '"/></div>',
|
||||
'titre' => _('publications::votre rss personnel')
|
||||
)
|
||||
);
|
||||
|
||||
return new Response($output, 200, array('Content-Type' => 'application/json'));
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($output, 'json')
|
||||
, 200
|
||||
, array('Content-Type' => 'application/json')
|
||||
);
|
||||
});
|
||||
|
||||
return $controllers;
|
||||
|
@@ -104,6 +104,8 @@ class Root implements ControllerProviderInterface
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
|
||||
$out = $twig->render('prod/index.html.twig', array(
|
||||
'module_name' => 'Production',
|
||||
'WorkZone' => new Helper\WorkZone($app['Core'], $app['request']),
|
||||
@@ -122,8 +124,8 @@ class Root implements ControllerProviderInterface
|
||||
'search_status' => \databox_status::getSearchStatus(),
|
||||
'queries_history' => \queries::history(),
|
||||
'thesau_js_list' => $thjslist,
|
||||
'thesau_json_sbas' => \p4string::jsonencode($sbas),
|
||||
'thesau_json_bas2sbas' => \p4string::jsonencode($bas2sbas),
|
||||
'thesau_json_sbas' => $Serializer->serialize($sbas, 'json'),
|
||||
'thesau_json_bas2sbas' => $Serializer->serialize($bas2sbas, 'json'),
|
||||
'thesau_languages' => \User_Adapter::avLanguages(),
|
||||
'GV_bitly_user' => $registry->get('GV_bitly_user'),
|
||||
'GV_bitly_key' => $registry->get('GV_bitly_key')
|
||||
|
@@ -62,7 +62,13 @@ class Upgrader implements ControllerProviderInterface
|
||||
|
||||
$datas = \Setup_Upgrade::get_status();
|
||||
|
||||
return new Response(\p4string::jsonencode($datas), 200, array('Content-Type: application/json'));
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
, 200
|
||||
, array('Content-Type: application/json')
|
||||
);
|
||||
});
|
||||
|
||||
$controllers->post('/execute/', function() use ($app)
|
||||
|
@@ -25,7 +25,6 @@ use Silex\ControllerCollection;
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
|
||||
class ConnectionTest implements ControllerProviderInterface
|
||||
{
|
||||
|
||||
@@ -90,13 +89,21 @@ class ConnectionTest implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return new Response(\p4string::jsonencode(array(
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
|
||||
$datas = array(
|
||||
'connection' => $connection_ok
|
||||
, 'database' => $db_ok
|
||||
, 'is_empty' => $empty
|
||||
, 'is_appbox' => $is_appbox
|
||||
, 'is_databox' => $is_databox
|
||||
)), 200, array('content-type' => 'application/json'));
|
||||
);
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
, 200
|
||||
, array('content-type' => 'application/json')
|
||||
);
|
||||
});
|
||||
|
||||
return $controllers;
|
||||
|
@@ -36,23 +36,39 @@ class PathFileTest implements ControllerProviderInterface
|
||||
{
|
||||
$path = $app['request']->get('path');
|
||||
|
||||
return new Response(\p4string::jsonencode(array(
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize(
|
||||
array(
|
||||
'exists' => file_exists($path)
|
||||
, 'file' => is_file($path)
|
||||
, 'dir' => is_dir($path)
|
||||
, 'readable' => is_readable($path)
|
||||
, 'writeable' => is_writable($path)
|
||||
, 'executable' => is_executable($path)
|
||||
)), 200, array('application/json'));
|
||||
)
|
||||
, 'json'
|
||||
)
|
||||
, 200
|
||||
, array('application/json')
|
||||
);
|
||||
});
|
||||
|
||||
$controllers->get('/url/', function() use ($app)
|
||||
{
|
||||
$url = $app['request']->get('url');
|
||||
|
||||
return new Response(\p4string::jsonencode(array(
|
||||
return new Response(
|
||||
$Serializer->serialize(
|
||||
array(
|
||||
'code' => \http_query::getHttpCodeFromUrl($url)
|
||||
)), 200, array('application/json'));
|
||||
)
|
||||
, 'json'
|
||||
)
|
||||
, 200
|
||||
, array('application/json')
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user