コード例 #1
0
 public function testUnserializeString()
 {
     //Valid string
     $result = Serializer::unserializeString('O:1:"a":1:{s:5:"value";s:3:"100";}');
     $this->assertNotNull($result);
     $this->assertIsA($result, "Object");
     //Invalid string
     $this->expectException("SerializerException");
     $result = Serializer::unserializeString("{'Organization': 'ThinkUp Documentation Team'}");
     $this->assertNull($result);
 }
コード例 #2
0
 /**
  * Get fully-rendered HTML markup for this insight.
  * @param  Insight $insight Test insight to render in HTML.
  * @return str Insight HTML with this insight
  */
 protected function getRenderedInsightInHTML(Insight $insight)
 {
     if ($insight->related_data !== null && is_string($insight->related_data)) {
         $insight->related_data = Serializer::unserializeString($insight->related_data);
     }
     $view = new ViewManager();
     $view->caching = false;
     $view->assign('insights', array($insight));
     $view->assign('expand', true);
     $view->assign('tpl_path', THINKUP_WEBAPP_PATH . 'plugins/insightsgenerator/view/');
     $view->assign('enable_bootstrap', true);
     $view->assign('thinkup_application_url', Utils::getApplicationURL());
     $view->assign('site_root_path', 'https://thinkup.thinkup.com/');
     $html_insight = $view->fetch(THINKUP_WEBAPP_PATH . '_lib/view/insights.tpl');
     return $html_insight;
 }
コード例 #3
0
ファイル: class.paginat.php プロジェクト: prabhatse/olx_hack
 public function getMostRecentInsight($slug, $instance_id)
 {
     $q = "SELECT * FROM #prefix#insights WHERE instance_id=:instance_id ";
     $q .= " AND slug=:slug ";
     $q .= "ORDER BY time_updated DESC LIMIT 1";
     $vars = array(':instance_id' => $instance_id, ":slug" => $slug);
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     $insight = $this->getDataRowAsObject($ps, "Insight");
     if ($insight->related_data !== null) {
         try {
             $insight->related_data = Serializer::unserializeString($insight->related_data);
         } catch (SerializerException $e) {
             $insight->related_data = null;
         }
     }
     return $insight;
 }