当前位置: 首页>>代码示例>>PHP>>正文


PHP Services_JSON::stringify方法代码示例

本文整理汇总了PHP中Services_JSON::stringify方法的典型用法代码示例。如果您正苦于以下问题:PHP Services_JSON::stringify方法的具体用法?PHP Services_JSON::stringify怎么用?PHP Services_JSON::stringify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Services_JSON的用法示例。


在下文中一共展示了Services_JSON::stringify方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 function get($module)
 {
     if (empty($module)) {
         $this->jerr("no module selected");
     }
     $this->init();
     //DB_DataObject::debugLevel(1);
     require_once 'Services/JSON.php';
     $d = DB_DataObject::factory('translations');
     $d->module = $module;
     $d->selectAdd();
     $d->selectAdd('distinct(tlang) as tlang');
     header('Content-type: text/javascript');
     $langs = $d->fetchAll('tlang');
     foreach ($langs as $lang) {
         // output the translations strings file..
         $this->loadOriginalStrings($module);
         $data = $this->loadTranslateDB($lang, $module);
         $j = new Services_JSON();
         echo "_T = _T || {} ; _T.{$lang}= Roo.apply( _T.{$lang} || { }, " . $j->stringify($data, null, 4) . ");\n";
     }
     exit;
 }
开发者ID:roojs,项目名称:Pman.Admin,代码行数:23,代码来源:InterfaceTranslations.php

示例2: bjs

 function bjs()
 {
     return $this->json;
     $data = json_decode($this->json);
     // munge data into bjs format..
     unset($data->xtype);
     $data->title = isset($data->title) ? $data->title : $data->name;
     require_once 'Services/JSON.php';
     return Services_JSON::stringify($data, null, 4);
 }
开发者ID:roojs,项目名称:Pman.Builder,代码行数:10,代码来源:Builder_part.php

示例3: writeTransMod

 /**
  * Writes a file MODULE.js inside of _translations_
  *
  * this should contain all contents from all the language directroris for this
  * module
  *
  */
 function writeTransMod($lang, $module, $data)
 {
     //print_R($data);
     $fn = $this->getTransFilename($lang, $module);
     require_once 'Services/JSON.php';
     $j = new Services_JSON();
     file_put_contents($fn, $j->stringify($data, null, 4));
     $ff = HTML_FlexyFramework::get();
     $base = $ff->rootDir . '/_translations_';
     $out = '';
     foreach (scandir($base) as $l) {
         if (!strlen($l) || $l[0] == '.' || !is_dir("{$base}/{$l}") || !file_exists("{$base}/{$l}/{$module}.json")) {
             continue;
         }
         // decode as our temp files contain spaces..
         $jdata = json_decode(file_get_contents("{$base}/{$l}/{$module}.json"));
         $out .= "_T.{$l}= Roo.apply( _T.{$l} || { }, " . json_encode($jdata) . ");\n";
     }
     //var_dump($out);
     if (strlen($out)) {
         file_put_contents("{$base}/{$module}.js", $out);
     }
     //$this->writeTrans($lang);
 }
开发者ID:roojs,项目名称:Pman.Admin,代码行数:31,代码来源:Translations.php

示例4: syncDatabase

 function syncDatabase()
 {
     //DB_DataObject::debugLevel(1);
     global $_DB_DATAOBJECT;
     $x = DB_DataObject::factory('builder_tables');
     $x->whereAdd("name != ''");
     // real tables only..
     $mine = $this->fetchAll('name', 'id');
     // ensure everything is loaded...
     $tq = DB_DataObject::factory('builder_tables');
     $tq->table();
     $tq->links();
     $tables = $_DB_DATAOBJECT['INI'][$tq->_database];
     $ret = array();
     $t = array_keys($tables);
     sort($t);
     // for postgres we can get descriptions - this should just fail in Mysql..
     $desc = array();
     $dsn = HTML_FlexyFramework::get()->database;
     if (preg_match('/^pgsql:/', $dsn)) {
         $tq = DB_DataObject::factory('builder_tables');
         $tq->query("\n                select relname, obj_description( oid) as desc FROM pg_catalog.pg_class\n                ");
         while ($tq->fetch()) {
             $desc[$tq->relname] = $tq->desc;
         }
     }
     //   DB_DataObjecT::DebugLevel(1);
     $tq = DB_DataObject::factory('builder_tables');
     require_once 'Services/JSON.php';
     $modids = array();
     foreach ($t as $k) {
         if (preg_match('/__keys$/', $k)) {
             continue;
         }
         // check it can be constructed..
         // this might be problematic for 'new' tables...
         $do = DB_DataObject::factory($k);
         if (!is_a($do, 'DB_DataObject')) {
             continue;
         }
         // get's the module part out of the dataobject class name
         // assumes '_' is not used in module name.
         $mod = array_pop(explode('_', substr(get_class($do), 0, -1 * (strlen('_DataObject_') + strlen($k) + 1))));
         // should get 'ZZZ' part.. : XXX_ZZZZ_DataObject_xx_Builder
         if (!isset($modids[$mod])) {
             $x = DB_DataObject::factory('builder_tables');
             $x->parent_id = 0;
             $x->name = '';
             $x->descrip = $mod;
             $x->dbschema = '';
             if (!$x->find(true)) {
                 $x->insert();
             }
             $modids[$mod] = $x->id;
         }
         $set = array('name' => $k, 'descrip' => isset($desc[$k]) ? $desc[$k] : '', 'dbschema' => Services_JSON::stringify($this->tableSchema($k), null, 4));
         $do = clone $tq;
         if (isset($mine[$k])) {
             $do->get($mine[$k]);
             $dd = clone $do;
             $do->setFrom($set);
             if (empty($do->parent_id) || $do->parent_id < 1) {
                 // allow user to modify this..
                 $do->parent_id = $modids[$mod];
             }
             $do->update($dd);
             continue;
         }
         $do->setFrom($set);
         $do->parent_id = $modids[$mod];
         $do->insert();
     }
 }
开发者ID:roojs,项目名称:Pman.Builder,代码行数:73,代码来源:Builder_tables.php


注:本文中的Services_JSON::stringify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。