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 ...
随机推荐
- MarkChanges: Jmeter
1. 20180627 调整启动的内存set HEAP=-Xms1024m -Xmx1024m2. 20180627 调整输出格式为xml #jmeter.save.saveservice.outpu ...
- Python - openpyxl 读写操作Excel
openpyxl特点 openpyxl(可读写excel表)专门处理Excel2007及以上版本产生的xlsx文件,xls和xlsx之间转换容易 注意:如果文字编码是“gb2312” 读取后就会显 ...
- Java 常用对象-BigInteger类
2017-11-02 21:57:09 BigInteger类:不可变的任意精度的整数.所有操作中,都以二进制补码形式表示 BigInteger(如 Java 的基本整数类型).BigInteger ...
- Java JDK5新特性-静态导入
2017-10-31 00:10:50 静态导入格式:import static 包名 ...类名.方法名: 也就说可以直接导入到方法名. 注意: 方法必须是静态的 如果有多个同名的静态方法,容易不知 ...
- C#复制文件
string pLocalFilePath ="";//要复制的文件路径 string pSaveFilePath ="";//指定存储的路径 if (File ...
- UVA-10061 How many zero's and how many digits ? (数论)
题目大意:让求n!在base进制下的位数以及末尾0的连续个数. 题目分析:一个m位的b进制数N,最小是b^(m-1),最大不超过b^m,即b^(m-1)≤N<b^m.解不等式,得log10(N) ...
- HDU-1163 Eddy's digital Roots(九余数定理)
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- ASP.NET网页生命周期事件
网页事件 典型的使用方式 PreInit PreInit事件是网页生命周期中非常早起的一个事件,在PreInit事件触发之后,就会加载用户设置信息与网页主题.我们通常使用PreInit事件来执行下列处 ...
- HDU 1940
//比赛的时候卡了三个点.今天卡了两个点.真心不愿意再看了. // 自己按照直线相交的思路的敲得.题意里说了不是按照final rank 给的.但是.这样就和标程输出不同. //就是觉得AC突然就不那 ...
- Python3.5+SQL+Prometheus+Grafana报表/监控
参考资料: pymysql 单独获取表的栏位名称 pymysql返回数据为字典形式(key:value--列:值) 行列结合,作为prometheus_client的输出. 话不多说,直接上脚本. ...