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


PHP saveJSON函数代码示例

本文整理汇总了PHP中saveJSON函数的典型用法代码示例。如果您正苦于以下问题:PHP saveJSON函数的具体用法?PHP saveJSON怎么用?PHP saveJSON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Load

 public function Load()
 {
     if (!file_exists(DATA . "/settings.php")) {
         saveJSON('settings.php', array($this->username => array('codiad.username' => $this->username)));
     }
     $settings = getJSON('settings.php');
     echo formatJSEND("success", $settings[$this->username]);
 }
开发者ID:practico,项目名称:Codiad,代码行数:8,代码来源:class.settings.php

示例2: saveOwnDictionary

function saveOwnDictionary($dictionary)
{
    if (!file_exists(DATA . "/config/" . USERDIC)) {
        file_put_contents(DATA . "/config/" . USERDIC, "");
    }
    $content = array('dictionary' => $dictionary);
    saveJSON(USERDIC, $content, "config");
}
开发者ID:Andr3as,项目名称:Codiad-CodeSpell,代码行数:8,代码来源:controller.php

示例3: loadJSON

/**
 * @param $objName to save under
 * @return PHP Array
 */
function loadJSON($objName, $default)
{
    $fpath = '../data/' . $objName . '.json';
    if (!file_exists($fpath)) {
        saveJSON($objName, $default);
        return $default;
    }
    //Retrieve the data from our text file.
    $fileContents = file_get_contents($fpath);
    //Convert the JSON string back into an array.
    $decoded = json_decode($fileContents, true);
    if ($decoded == null) {
        $decoded = $default;
    }
    return $decoded;
}
开发者ID:mkahn-optv,项目名称:amstelbright,代码行数:20,代码来源:shared.php

示例4: Save

 public function Save()
 {
     $data = array();
     if (isset($_GET['n'])) {
         foreach ($_GET['n'] as $key => $name) {
             $tmp['n'] = trim($name);
             $tmp['d'] = trim($_GET["d"][$key]);
             $tmp['a'] = trim($_GET["a"][$key]);
             $tmp['t'] = trim($_GET["t"][$key]);
             $tmp['i'] = trim($_GET["i"][$key]);
             $tmp['c'] = trim($_GET["c"][$key]);
             array_push($data, $tmp);
         }
     }
     saveJSON("/config/" . get_called_class() . ".php", $data);
     echo formatJSEND("success", null);
 }
开发者ID:practico,项目名称:Codiad-Macro,代码行数:17,代码来源:class.macro.php

示例5: pull

 public function pull()
 {
     $cli_params = array();
     $cli_params[] = "--non-interactive";
     if ($this->username != '') {
         $cli_params[] = "--username " . $this->username;
     }
     if ($this->password != '') {
         //Need to clean up the password so it can be passed to the cli, If anyone find's or thinks of more let me know tholum@couleetechlink.com
         $this->password = str_replace(array("*", "^", "&", '"'), array('\\*', '\\^', '\\&', '\\"'), $this->password);
         $cli_params[] = "--password " . $this->password;
     }
     if ($this->svnrepo) {
         if (!$this->isAbsPath($this->path)) {
             if (!file_exists(WORKSPACE . '/' . $this->path)) {
                 $this->command_exec = "cd " . WORKSPACE . " && svn co \"" . $this->svnrepo . "\" " . $this->path . " " . implode(" ", $cli_params);
             } else {
                 die(formatJSEND("success", array("message" => "Folder already exists")));
             }
         } else {
             if (!file_exists($this->path)) {
                 $this->command_exec = "cd " . WORKSPACE . " && svn co \"" . $this->svnrepo . "\" " . $this->path . " " . implode(" ", $cli_params);
             } else {
                 die(formatJSEND("success", array("message" => "Folder already exists")));
             }
         }
         if ($this->newproject) {
             $this->projects = getJSON('projects.php');
             $this->projects[] = array("name" => $this->name, "path" => $this->path);
             saveJSON('projects.php', $this->projects);
         }
         $this->ExecuteCMD();
         echo formatJSEND("success", array("message" => "Repo cloned"));
     } else {
         echo formatJSEND("error", array("message" => "No Repo specified"));
     }
 }
开发者ID:practico,项目名称:Codiad-SVN,代码行数:37,代码来源:class.svn.php

示例6: cleanPath

    } else {
        $project_path = cleanPath($project_path);
        if (substr($project_path, -1) == '/') {
            $project_path = substr($project_path, 0, strlen($project_path) - 1);
        }
        if (!file_exists($project_path)) {
            if (!mkdir($project_path . '/', 0755, true)) {
                die("Unable to create Absolute Path");
            }
        } else {
            if (!is_writable($project_path) || !is_readable($project_path)) {
                die("No Read/Write Permission");
            }
        }
    }
    $project_data = array("name" => $project_name, "path" => $project_path);
    saveJSON($projects, array($project_data));
    //////////////////////////////////////////////////////////////////
    // Create Users file
    //////////////////////////////////////////////////////////////////
    $user_data = array("username" => $username, "password" => $password, "project" => $project_path);
    saveJSON($users, array($user_data));
    //////////////////////////////////////////////////////////////////
    // Create Active file
    //////////////////////////////////////////////////////////////////
    saveJSON($active, array(''));
    //////////////////////////////////////////////////////////////////
    // Create Config
    //////////////////////////////////////////////////////////////////
}
echo "success";
开发者ID:iFromzForks,项目名称:appengine-codiad,代码行数:31,代码来源:process.php

示例7: error_reporting

 * This information must remain intact.
 */
error_reporting(0);
require_once '../../common.php';
checkSession();
switch ($_GET['action']) {
    case 'load':
        if (file_exists(DATA . "/config/" . getFileName())) {
            echo json_encode(getJSON(getFileName(), "config"));
        } else {
            echo json_encode(array());
        }
        break;
    case 'save':
        if (isset($_POST['data'])) {
            saveJSON(getFileName(), json_decode($_POST['data']), "config");
            echo '{"status":"success","message":"Data saved"}';
        } else {
            echo '{"status":"error","message":"Missing Parameter"}';
        }
        break;
    case 'isDir':
        if (isset($_GET['path'])) {
            $result = array();
            $result['status'] = "success";
            $result['result'] = is_dir(getWorkspacePath($_GET['path']));
            echo json_encode($result);
        } else {
            echo '{"status":"error","message":"Missing Parameter"}';
        }
        break;
开发者ID:practico,项目名称:Codiad-Ignore,代码行数:31,代码来源:controller.php

示例8: unset

// Only admins.
if (empty($_SESSION[$RootSession])) {
    $_SESSION[$RootSession] = false;
}
$session = $_SESSION[$RootSession];
if ($session === true) {
    unset($_SESSION['redirlink']);
    if (isset($_POST['submitted'])) {
        $BetaModeStatus = $_POST['betamode'];
        if ($BetaModeStatus == "true") {
            $finalarray = array(true);
        }
        if ($BetaModeStatus == "false") {
            $finalarray = array(false);
        }
        saveJSON("beta_mode", $finalarray);
        echo "Updated!";
        $finaladdr = $CurrentDirectory . "BetaMode.php";
        echo "<META http-equiv='refresh' content='1;URL={$finaladdr}'>";
    } else {
        $betamode = getJSON("beta_mode");
        if ($betamode[0] == true) {
            $betamodeword = "true";
        } elseif ($betamode[0] == false) {
            $betamodeword = "false";
        } else {
            $betamodeword = "error :(";
        }
        if ($detect->isiOS()) {
            ?>
<!DOCTYPE html>
开发者ID:pyrotuc,项目名称:Cydia-UDID-Protected-Repo-PHP,代码行数:31,代码来源:BetaMode.php

示例9: OptOut

 public function OptOut()
 {
     $current = getJSON('version.php');
     $version[] = array("version" => $current[0]['version'], "time" => $current[0]['time'], "optout" => "true", "name" => $current[0]['name']);
     saveJSON('version.php', $version);
 }
开发者ID:codiad,项目名称:codiad,代码行数:6,代码来源:class.update.php

示例10: setSettings

 public function setSettings($update, $path)
 {
     $settings = getJSON(CONFIG, 'config');
     foreach ($update as $i => $item) {
         if (strlen($item) == 0) {
             unset($update[$i]);
             unset($settings[$i]);
             if (strpos($i, "local_") !== false) {
                 unset($settings[$path]);
             }
             continue;
         }
         if (strpos($i, "local_") !== false) {
             if (!isset($settings[$path])) {
                 $settings[$path] = array();
             }
             $index = str_replace("local_", "", $i);
             $settings[$path][$index] = $item;
             unset($settings[$i]);
             unset($update[$i]);
         }
         if (isset($update[$i])) {
             $settings[$i] = $update[$i];
         }
     }
     saveJSON(CONFIG, $settings, 'config');
 }
开发者ID:practico,项目名称:Codiad-CodeGit,代码行数:27,代码来源:class.git.php

示例11: saveJSON

                    }
                }
                saveJSON("approved_udids_2", $approved_udids);
                echo "User deleted!";
                $finaladdr = $CurrentDirectory . "ManageUDID.php";
                echo "<META http-equiv='refresh' content='1;URL={$finaladdr}'>";
            }
        } else {
            // If it doesn't exist
            $userudid = $_POST['udid'];
            $newuserlevel = $_POST['level'];
            $newusername = $_POST['name'];
            $oldarray = getJSON("approved_udids_2");
            $newarray = array($userudid, $newuserlevel, $newusername);
            array_push($oldarray, $newarray);
            saveJSON("approved_udids_2", $oldarray);
            echo "User added!";
            $finaladdr = $CurrentDirectory . "ManageUDID.php";
            echo "<META http-equiv='refresh' content='1;URL={$finaladdr}'>";
        }
    } else {
        // Otherwise, show.
        $approved_udids = getJSON("approved_udids_2");
        if ($detect->isiOS()) {
            ?>
<!DOCTYPE html>
<html>
<head>
    <link href="ios7css.css" rel="stylesheet">
    <meta content="width=device-width, user-scalable=no" name="viewport">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"><title>All UDIDs</title></head><body>
开发者ID:pyrotuc,项目名称:Cydia-UDID-Protected-Repo-PHP,代码行数:31,代码来源:ManageUDID.php

示例12: array

            } else {
                $prepDebs = $originalArrayDebs;
            }
            if (!array_key_exists($ident, $prepName)) {
                $newArrayNames = array($ident => $name);
                $newArrayDescs = array($ident => $desc);
                $newArrayDebs = array($ident => $debnames);
                // name merge
                $finalName = array_merge($prepName, $newArrayNames);
                saveJSON("descriptions/names", $finalName);
                // description merge
                $finalDesc = array_merge($prepDesc, $newArrayDescs);
                saveJSON("descriptions/description", $finalDesc);
                // deb merge
                $finalDebs = array_merge($prepDebs, $newArrayDebs);
                saveJSON("debnames", $finalDebs);
                $usedindep = true;
            } else {
                echo "Depiction already exists.<br><br>";
            }
            //////////////////////////////////////////////
        }
        if ($usedindep === false) {
            if ($detect->isiOS()) {
                ?>
<!DOCTYPE html>
<html>
<head>
    <link href="ios7css.css" rel="stylesheet">
    <meta content="width=device-width, user-scalable=no" name="viewport">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"><title><?php 
开发者ID:pyrotuc,项目名称:Cydia-UDID-Protected-Repo-PHP,代码行数:31,代码来源:CreateFile.php

示例13: MarkFileAsFocused

 public function MarkFileAsFocused()
 {
     foreach ($this->actives as $active => $data) {
         if (is_array($data) && isset($data['username']) && $this->username == $data['username']) {
             $this->actives[$active]['focused'] = false;
             if ($this->path == $data['path']) {
                 $this->actives[$active]['focused'] = true;
             }
         }
     }
     saveJSON('active.php', $this->actives);
     echo formatJSEND("success");
 }
开发者ID:codiad,项目名称:codiad,代码行数:13,代码来源:class.active.php

示例14: error_reporting

<?php

/*
 * Copyright (c) Codiad & Andr3as, distributed
 * as-is and without warranty under the MIT License. 
 * See http://opensource.org/licenses/MIT for more information.
 * This information must remain intact.
 */
error_reporting(0);
require_once '../../common.php';
checkSession();
switch ($_GET['action']) {
    case 'save':
        if (isset($_POST['settings'])) {
            saveJSON("beautify.settings.php", json_decode($_POST['settings']), "config");
            echo '{"status":"success","message":"Settings saved"}';
        } else {
            echo '{"status":"error","message":"Missing parameter"}';
        }
        break;
    case 'load':
        if (file_exists(DATA . "/config/beautify.settings.php")) {
            echo json_encode(getJSON("beautify.settings.php", "config"));
        } else {
            echo file_get_contents("default.settings.json");
        }
        break;
    case 'saveContent':
        if (isset($_GET['path']) && isset($_POST['content'])) {
            if (file_put_contents(getWorkspacePath($_GET['path']), $_POST['content']) === false) {
                echo '{"status":"error","message":"Failed to save content"}';
开发者ID:practico,项目名称:Codiad-Beautify,代码行数:31,代码来源:controller.php

示例15: array

    case 'abba':
        $rowsABBA = array();
        foreach ($rowsKeys as $k => $row) {
            $tab = explode(' | ', $row['ga:eventLabel']);
            /** variant */
            $abba_label = $tab[0];
            /** views | goals */
            $action_type = $tab[1];
            switch ($action_type) {
                case 'views':
                    $rowsABBA[$abba_label]['number_of_trials'] = $row['ga:totalEvents'];
                    break;
                case 'goal':
                    $rowsABBA[$abba_label]['number_of_successes'] = $row['ga:totalEvents'];
                    break;
                default:
                    break;
            }
        }
        $abba = array('config' => array('intervalConfidenceLevel' => $config['intervalConfidenceLevel'], 'multipleTestingCorrection' => $config['multipleTestingCorrection']));
        $abba['data'] = $rowsABBA;
        $json = json_encode($abba);
        $filename = prepareFilename($configFile, $config['outputFormat']);
        if (saveJSON($filename, $config['outputDirectory'], $json)) {
            echo info("Saved to file " . $filename . "\n");
        }
        break;
    default:
        echo error("Unknown output format\n");
        break;
}
开发者ID:WeMoveEU,项目名称:google-api,代码行数:31,代码来源:events.php


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