Texas Instruments matrix-gui-2.0 hacking -- helper_functions.php
<?php # PHP_SELF: 但前正在执行脚本的文件名,与document root相关
# QUERY_STRING: 查询(query)的字符串
$cachefile = "cache".$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
# ^
function start_caching() # |
{ # |
//Use the global $cachefile variable # |
global $cachefile; # -->---->--+ //There is a random string to the end of the $_GET Query String to
//prevent IE from caching the Ajax request. The below line removes the random portion
//of the query so we can cache the page properly in php
if(stripos($cachefile, "&rand=")==true)
$cachefile = substr($cachefile,,stripos($cachefile, "&rand=")); if (file_exists($cachefile))
{
// the page has been cached from an earlier request
// output the contents of the cache file
include($cachefile);
// exit the script, so that the rest isnt executed
exit;
}
else
ob_start();
} function get_application($dot_desktop_array,$submenu,$app_name)
{
for($i = ;$i<count($dot_desktop_array[$submenu]["apps"]);$i++)
{
if($dot_desktop_array[$submenu]["apps"][$i]["Name"]==$app_name)
return $dot_desktop_array[$submenu]["apps"][$i];
}
return NULL;
} function end_caching()
{
//Use the global $cachefile variable
global $cachefile; //Disable Caching on Description Page
// open the cache file "cache/home.html" for writing
$fp = fopen($cachefile, 'w');
// save the contents of output buffer to the file
fwrite($fp, ob_get_contents());
// close the file
fclose($fp);
// Send the output to the browser
ob_end_flush();
} function get_submenu($dot_desktop_array,$submenu_name)
{
# foreach 循环
# $k: 表示数组的下标
# $v: 表示k下标对应的数组值
foreach ($dot_desktop_array as $k => $v)
{
for($j = ;$j<count($v["apps"]);$j++)
{
$current_entry = $v["apps"][$j]; # 如果当前的记录类型是目录,并且当前分类和给定名字一样,那么返回该对象
if($current_entry["Type"]=="directory" && $current_entry["Category"] == $submenu_name)
return $current_entry;
}
}
return NULL;
} function read_desktop_file()
{
# 检查json.txt是否存在,并且json.txt文件长度不为0
if(file_exists("json.txt") == true && filesize("json.txt") != )
{
# 打开并读取文件
$handle = fopen("json.txt", "rb");
$contents = fread($handle,filesize("json.txt"));
fclose($handle); # 接受一个JSON格式的字符串并且把它转换为PHP变量,
# 返回解析后的json对象
return json_decode($contents,true);
}
else
return null;
} ?>
Texas Instruments matrix-gui-2.0 hacking -- helper_functions.php的更多相关文章
- Texas Instruments matrix-gui-2.0 hacking -- app_description.php
<?php /* * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ * * * Redistrib ...
- Texas Instruments matrix-gui-2.0 hacking -- submenu.php
<?php /* * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ * * * Redistrib ...
- Texas Instruments matrix-gui-2.0 hacking -- run_script.php
<?php /* * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ * * * Redistrib ...
- Texas Instruments matrix-gui-2.0 hacking -- index.php
<?php /* * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ * * * Redistrib ...
- Texas Instruments matrix-gui-2.0 hacking -- menubar.php
<?php /* * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ * * * Redistrib ...
- Texas Instruments matrix-gui-2.0 hacking -- generate.php
<?php /* * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ * * * Redistrib ...
- Texas Instruments matrix-gui-2.0 hacking -- execute_command.sh
#!/bin/sh #Copyright (C) Texas Instruments Incorporated - http://www.ti.com/ # # # Redistribution an ...
- 【LeetCode每天一题】Set Matrix Zeroes(设置0矩阵)
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. Exampl ...
- Texas Instruments matrix-gui-2.0 hacking -- json.txt
{ "main_menu": { "apps": [ { "Name":"Profiling", ", &qu ...
随机推荐
- shell :
示例一.(用作注释,占位)#!/bin/bash : this is single line comment : 'this is a multiline comment, second line e ...
- 编写一个截取字符串的函数,输入为一个字符串和字节数,输出为按字节截取的字符串。 但是要保证汉字不被截半个,如“我ABC”4,应该截为“我AB”,输入“我ABC汉DEF”,6,应该输出为“我ABC”而不是“我ABC+汉的半个”。
一.需要分析 1.输入为一个字符串和字节数,输出为按字节截取的字符串--->按照字节[byte]截取操作字符串,先将String转换成byte类型 2.汉字不可以截半--->汉字截半的话对 ...
- 《剑指offer》第三十题(包含min函数的栈)
// 面试题30:包含min函数的栈 // 题目:定义栈的数据结构,请在该类型中实现一个能够得到栈的最小元素的min // 函数.在该栈中,调用min.push及pop的时间复杂度都是O(1). #i ...
- c语言中的0UL或1UL是什么意思
0UL 表示 无符号长整型 0 1UL 表示 无符号长整型 1 如果不写UL后缀,系统默认为:int, 即,有符号整数. 1.数值常数有:整型常数.浮点常数:2.只有数值常数才有后缀说明:3.数值常数 ...
- Web端主流框架,jquery、angular、react、vue
不得不说,前端技术发展非常迅速,时不多久就有一个新的东西冒出来,并且迅速膨胀发展,让旁观者眼花缭乱,让开发者目眩神迷,但总体上来说,这波互联网大浪潮带动了前端技术的大发展,给曾经那些苦苦挣扎于DOM操 ...
- 读CSV转换datatable
using System.Data; using System.IO; /// <summary> /// Stream读取.csv文件 /// </summary> // ...
- Howto: 使用ImageBrush替换PictureMarkerSymbol以加强graphic显示性能
软件: ArcGIS API for Microsoft Silverlight/WPF 9.3.1 操作系统: N/A 摘要: ArcGIS API for Microsoft ...
- SQL 进阶视频课程。Udacity: Intro to Relational Databases和 PostgreSQL语法文档。
Udacity: Intro to Relational Databases The syntax of the select statement with a where clause: selec ...
- Oracle性能诊断艺术-读书笔记(脚本dbms_xplan_output截图-非常好的)
- Android 时钟(由秒转变为时分秒)
int second = 0: Handler handler = new Handler(); handler.post(runnable); Runnable runnable = new Run ...