本文整理汇总了PHP中Functions类的典型用法代码示例。如果您正苦于以下问题:PHP Functions类的具体用法?PHP Functions怎么用?PHP Functions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Functions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: process
public function process($parentRule)
{
static $thisFunction;
if (!$thisFunction) {
$thisFunction = new Functions(array('this' => 'CssCrush\\fn__this'));
}
if (!$this->skip) {
// this() function needs to be called exclusively because it is self referencing.
$context = (object) array('rule' => $parentRule);
$this->value = $thisFunction->apply($this->value, $context);
if (isset($parentRule->declarations->data)) {
$parentRule->declarations->data += array($this->property => $this->value);
}
$context = (object) array('rule' => $parentRule, 'property' => $this->property);
$this->value = Crush::$process->functions->apply($this->value, $context);
}
// Whitespace may have been introduced by functions.
$this->value = trim($this->value);
if ($this->value === '') {
$this->valid = false;
return;
}
$parentRule->declarations->queryData[$this->property] = $this->value;
$this->indexFunctions();
}
开发者ID:MrHidalgo,项目名称:css-crush,代码行数:25,代码来源:Declaration.php
示例2: __construct
public function __construct($str)
{
static $templateFunctions;
if (!$templateFunctions) {
$templateFunctions = new Functions();
}
$str = Template::unTokenize($str);
// Parse all arg function calls in the passed string,
// callback creates default values.
$self = $this;
$captureCallback = function ($str) use(&$self) {
$args = Functions::parseArgsSimple($str);
$position = array_shift($args);
// Match the argument index integer.
if (!isset($position) || !ctype_digit($position)) {
return '';
}
// Store the default value.
$defaultValue = isset($args[0]) ? $args[0] : null;
if (isset($defaultValue)) {
$self->defaults[$position] = $defaultValue;
}
// Update argument count.
$argNumber = (int) $position + 1;
$self->argCount = max($self->argCount, $argNumber);
return "?a{$position}?";
};
$templateFunctions->register['#'] = $captureCallback;
$templateFunctions->register['arg'] = $captureCallback;
$this->string = $templateFunctions->apply($str);
}
开发者ID:MrHidalgo,项目名称:css-crush,代码行数:31,代码来源:Template.php
示例3: write_div_table_display_records
function write_div_table_display_records($order = null, $order_type = null)
{
$data['stocks'] = $this->Stocks_model->get_all_display($order, $order_type);
$functions = new Functions();
$link_to_screen = base_url() . 'inventory/stocks';
return $functions->display_data_table($data['stocks'], $link_to_screen, $this);
}
开发者ID:goudaelalfy,项目名称:erp,代码行数:7,代码来源:stocks.php
示例4: actionGetAddress
public function actionGetAddress()
{
$value = $_POST['val'];
$function = new Functions();
$address = $function->getAddress($value);
$this->renderPartial('getAddress', array('address' => $address));
}
开发者ID:azizbekvahidov,项目名称:convertus,代码行数:7,代码来源:DefaultController.php
示例5: do_update
function do_update()
{
$Q[] = "ALTER TABLE exp_members ADD `ignore_list` text not null AFTER `sig_img_height`";
/*
* ------------------------------------------------------
* Add Edit Date and Attempt to Intelligently Set Values
* ------------------------------------------------------
*/
require PATH_CORE.'core.localize'.EXT;
$LOC = new Localize();
$Q[] = "ALTER TABLE exp_templates ADD `edit_date` int(10) default 0 AFTER `template_notes`";
$Q[] = "UPDATE exp_templates SET edit_date = '".$LOC->now."'";
$query = $this->EE->db->query("SELECT item_id, MAX(item_date) as max_date FROM `exp_revision_tracker` GROUP BY item_id");
if ($query->num_rows() > 0)
{
foreach($query->result_array() as $row)
{
$Q[] = "UPDATE exp_templates SET edit_date = '".$DB->escape_str($row['max_date'])."' WHERE template_id = '".$DB->escape_str($row['item_id'])."'";
}
}
/*
* ------------------------------------------------------
* Add Hash for Bulletins and Set For Existing Bulletins
* ------------------------------------------------------
*/
$Q[] = "ALTER TABLE `exp_member_bulletin_board` ADD `hash` varchar(10) default '' AFTER `bulletin_date`";
$Q[] = "ALTER TABLE `exp_member_bulletin_board` ADD INDEX (`hash`)";
$query = $this->EE->db->query("SELECT DISTINCT bulletin_date, bulletin_message, sender_id FROM `exp_member_bulletin_board`");
if ($query->num_rows() > 0)
{
require PATH_CORE.'core.functions'.EXT;
$FNS = new Functions();
foreach($query->result_array() as $row)
{
$Q[] = "UPDATE exp_member_bulletin_board SET hash = '".$DB->escape_str($FNS->random('alpha', 10))."'
WHERE bulletin_date = '".$DB->escape_str($row['bulletin_date'])."'
AND bulletin_message = '".$DB->escape_str($row['bulletin_message'])."'
AND sender_id = '".$DB->escape_str($row['sender_id'])."'";
}
}
// run the queries
foreach ($Q as $sql)
{
$this->EE->db->query($sql);
}
return TRUE;
}
开发者ID:rmdort,项目名称:adiee,代码行数:58,代码来源:ud_152.php
示例6: actionAddAddr
public function actionAddAddr()
{
$func = new Functions();
if (isset($_POST['addresses'])) {
foreach ($_POST['addresses'] as $key => $val) {
$id = $func->createReestr($val, $_POST['id']);
$model[$key] = Yii::app()->db->createCommand()->select()->from('reestrAddr r')->join('addresses adr', 'adr.addressesID = r.addressId')->where('r.reestrAddrId = :id', array(':id' => $id))->queryRow();
}
}
$this->renderPartial('partial/addAddr', array('model' => $model));
}
开发者ID:azizbekvahidov,项目名称:convertus,代码行数:11,代码来源:DefaultController.php
示例7: genPls
public function genPls()
{
$read = new Functions();
$channel = $read->openFile();
foreach ($channel as $key => $value) {
$read->getServerInfo($value);
$name = $read->name;
$this->genRam($read->chan, $read->ip, $read->port);
$this->genAsx($read->chan, $read->ip, $read->port);
$this->genM3u($read->chan, $read->ip, $read->port, $name);
}
echo 'Generowanie plikow playlist zakonczone sukcesem.';
}
开发者ID:anzasolutions,项目名称:radioldn,代码行数:13,代码来源:PlayList.class.php
示例8: expandAliases
public static function expandAliases($str)
{
$process = Crush::$process;
if (!$process->selectorAliases || !preg_match($process->selectorAliasesPatt, $str)) {
return $str;
}
while (preg_match_all($process->selectorAliasesPatt, $str, $m, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
$alias_call = end($m);
$alias_name = strtolower($alias_call[1][0]);
$start = $alias_call[0][1];
$length = strlen($alias_call[0][0]);
$args = array();
// It's a function alias if a start paren is matched.
if (isset($alias_call[2])) {
// Parse argument list.
if (preg_match(Regex::$patt->parens, $str, $parens, PREG_OFFSET_CAPTURE, $start)) {
$args = Functions::parseArgs($parens[2][0]);
// Amend offsets.
$paren_start = $parens[0][1];
$paren_len = strlen($parens[0][0]);
$length = $paren_start + $paren_len - $start;
}
}
$str = substr_replace($str, $process->selectorAliases[$alias_name]($args), $start, $length);
}
return $str;
}
开发者ID:MrHidalgo,项目名称:css-crush,代码行数:27,代码来源:Selector.php
示例9: amchroot_edit
function amchroot_edit($domain, $mode)
{
$cmd = "amh module AMChroot-1.1 admin edit,{$domain},{$mode}";
$cmd = Functions::trim_cmd($cmd);
exec($cmd, $tmp, $status);
return !$status;
}
开发者ID:logdns,项目名称:amh-4.2,代码行数:7,代码来源:amchroots.php
示例10: module_delete
function module_delete($name)
{
$cmd = "amh module {$name} delete y";
$cmd = Functions::trim_cmd($cmd);
exec($cmd, $tmp, $status);
return !$status;
}
开发者ID:logdns,项目名称:amh-4.2,代码行数:7,代码来源:modules.php
示例11: checkDate
public static function checkDate($date, $class)
{
//check if set and date null
//return error
if (!isset($class->date) && $date == null) {
//return error code and msg if there is no date set;
$error = Functions::error(100, "Date is not set");
} else {
if ($date == null) {
//set date from class
$date = $class->date;
}
}
//check if format is right
$date = date_create_from_format('d.m.Y', $date);
//if format is not correct
if ($date == false) {
$error = Functions::error(100, "Date is not in right format (d.m.Y)");
}
//get format back, no clock needed
$date = date_format($date, 'd.m.Y');
//return right date
//date in function getData('date') is more imporatant than set date in class
return $date;
}
开发者ID:Wassawah,项目名称:Finance-v0,代码行数:25,代码来源:functions.php
示例12: discover
/**
* Discovers all the annotations of a given class file
*
* @param string $class a class file
* @return array
*/
public static function discover($class)
{
try {
if (!file_exists($class)) {
throw new Exception($class . " does not exist");
}
$text = file($class, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$annotations = array();
$currentAnnotations = array();
foreach ($text as $key => $line) {
if (strpos($line, "* @annotation") !== false) {
$currentAnnotations[] = trim(str_replace("* @annotation", "", $line));
} else {
$functionName = "";
if (count($currentAnnotations) > 0 && Annotation::discoverFunctionName($line, $functionName)) {
$annotations[$functionName] = $currentAnnotations;
$currentAnnotations = array();
}
unset($text[$key]);
}
}
return $annotations;
} catch (Exception $e) {
Functions::dump($e->getMessage());
return NULL;
}
}
开发者ID:Romayne,项目名称:MVC-MVVM-Annotations-Framework,代码行数:33,代码来源:Annotation.class.php
示例13: get_metadata
public static function get_metadata($url)
{
$xml = Functions::lookup_with_cache($url, array('validation_regex' => 'xmlns:'));
$simple_xml = simplexml_load_string($xml);
$params = array();
$dcterms = $simple_xml->children("http://dublincore.org/documents/dcmi-terms/");
$dwc = $simple_xml->children("http://digir.net/schema/conceptual/darwin/2003/1.0");
$params['source'] = (string) $dcterms->identifier;
$data_object = $simple_xml->dataObject;
$dcterms = $data_object->children("http://dublincore.org/documents/dcmi-terms/");
$params['citation'] = (string) $dcterms->bibliographicCitation;
$params['identifier'] = (string) $dcterms->identifier;
$params['data_type'] = "http://purl.org/dc/dcmitype/Text";
$params['mime_type'] = "text/html";
$params['license'] = "not applicable";
$params['agents'] = array();
foreach ($data_object->agent as $agent) {
$agent_name = (string) $agent;
$attr = $agent->attributes();
$agent_role = (string) @$attr['role'];
$params['agents'][] = array($agent_name, $agent_role);
}
print_r($xml);
// print_r($params);
echo "\n\n\n";
}
开发者ID:eliagbayani,项目名称:maps_test,代码行数:26,代码来源:Plazi.php
示例14: init
public function init()
{
parent::init();
// Create new field in your users table for store dashboard preference
// Set table name, user ID field name, user preference field name
$this->setTableParams('dashboard_page', 'user_id', 'title');
// set array of portlets
$this->setPortlets(array(array('id' => 1, 'title' => 'Ultimos clientes', 'content' => Customer::model()->Top(4)), array('id' => 2, 'title' => 'Ultimas reservas', 'content' => Book::model()->Top(4)), array('id' => 3, 'title' => 'Puntos críticos', 'content' => Point::model()->Top(4)), array('id' => 4, 'title' => 'Ultimos boletines', 'content' => Mail::model()->Top(4)), array('id' => 5, 'title' => 'Informes', 'content' => Functions::lastReports()), array('id' => 6, 'title' => 'Ultimas facturas', 'content' => Invoice::model()->Top(4))));
//set content BEFORE dashboard
$this->setContentBefore();
// uncomment the following to apply jQuery UI theme
// from protected/components/assets/themes folder
$this->applyTheme('ui-lightness');
// uncomment the following to change columns count
//$this->setColumns(4);
// uncomment the following to enable autosave
$this->setAutosave(true);
// uncomment the following to disable dashboard header
$this->setShowHeaders(false);
// uncomment the following to enable context menu and add needed items
/*
$this->menu = array(
array('label' => 'Index', 'url' => array('index')),
);
*/
}
开发者ID:FranHurtado,项目名称:hotels,代码行数:26,代码来源:DashController.php
示例15: loop_resolve_list
function loop_resolve_list($list_text)
{
// Resolve the list of items for iteration.
// Either a generator function or a plain list.
$items = array();
$list_text = Crush::$process->functions->apply($list_text);
$generator_func_patt = Regex::make('~(?<func>range|color-range) {{parens}}~ix');
if (preg_match($generator_func_patt, $list_text, $m)) {
$func = strtolower($m['func']);
$args = Functions::parseArgs($m['parens_content']);
switch ($func) {
case 'range':
$items = call_user_func_array('range', $args);
break;
default:
$func = str_replace('-', '_', $func);
if (function_exists("CssCrush\\loop_{$func}")) {
$items = call_user_func_array("CssCrush\\loop_{$func}", $args);
}
}
} else {
$items = Util::splitDelimList($list_text);
}
return $items;
}
开发者ID:MrHidalgo,项目名称:css-crush,代码行数:25,代码来源:loop.php
示例16: getPublicFile
public static function getPublicFile($name = "index.php", $template = "", $lang = "")
{
if ($filename = Functions::getPublicFileURL($name, $template, $lang)) {
return file_get_contents($filename);
}
return false;
}
开发者ID:youssefbenhssaien,项目名称:MVC-PHP,代码行数:7,代码来源:Functions.php
示例17: Instance
public static function Instance()
{
if (self::$_instance === false) {
self::$_instance = new Functions();
}
return self::$_instance;
}
开发者ID:adammajchrzak,项目名称:silesiamaps,代码行数:7,代码来源:Functions.php
示例18: fleaditlater_plugin_displayEvents
function fleaditlater_plugin_displayEvents(&$myUser)
{
$mysqli = new MysqlEntity();
$query = $mysqli->customQuery('SELECT le.id,le.title,le.link FROM `' . MYSQL_PREFIX . 'event` le INNER JOIN `' . MYSQL_PREFIX . 'plugin_feaditlater` fil ON (le.id=fil.event)');
if ($query != null) {
echo '<aside class="fleaditLaterMenu">
<h3 class="left">' . _t('P_FLEADITLATER_TOREAD') . '</h3>
<ul class="clear">
<li>
<ul> ';
while ($data = $query->fetch_array()) {
echo '<li>
<img src="plugins/fleaditlater/img/read_icon.png">
<a title="' . $data['link'] . '" href="' . $data['link'] . '" target="_blank">
' . Functions::truncate($data['title'], 38) . '
</a>
<button class="right" onclick="fleadItLater(' . $data['id'] . ',\'delete\',this)" style="margin-left:5px;margin-top:5px;">
<span title="' . _t('P_FLEADITLATER_MARK_AS_READ') . '" alt="' . _t('P_FLEADITLATER_MARK_AS_READ') . '">' . _t('P_FLEADITLATER_MARK_AS_READ_SHORT') . '</span>
</button>
</li>';
}
echo '</ul>
</li>
</ul>
</aside>';
}
}
开发者ID:kraoc,项目名称:Leed-market,代码行数:31,代码来源:fleaditlater.plugin.disabled.php
示例19: __construct
/**
* try {
* $input = \itcube\Input::Instance();
* } catch (Exception $e) {
* echo $e->getMessage() . "\n";
* }
*/
public function __construct()
{
global $_GET, $_POST, $_COOKIE, $_FILES, $_SERVER;
$this->properties = array();
$this->server = $_SERVER;
if (isset($_POST) && Functions::array_count($_POST) > 0) {
foreach ($_POST as $key => $val) {
$this->properties['POST'][$this->_clean_key($key)] = $this->_clean_val($val);
}
}
if (isset($_GET) && Functions::array_count($_GET) > 0) {
foreach ($_GET as $key => $val) {
$this->properties['GET'][$this->_clean_key($key)] = $this->_clean_val($val);
}
}
if (isset($_COOKIE) && Functions::array_count($_COOKIE) > 0) {
foreach ($_COOKIE as $key => $val) {
$this->properties['COOKIE'][$this->_clean_key($key)] = $this->_clean_val($val);
}
}
if (isset($_FILES) && Functions::array_count($_FILES) > 0) {
foreach ($_FILES as $key => $val) {
$this->properties['FILES'][$this->_clean_key($key)] = $this->_clean_val($val);
}
}
}
开发者ID:segseriy,项目名称:itcube-functions,代码行数:33,代码来源:Input.php
示例20: __invoke
public function __invoke($object)
{
foreach ($this->_functions as $function) {
$object = Functions::call($function, $object);
}
return $object;
}
开发者ID:letsdrink,项目名称:ouzo,代码行数:7,代码来源:FluentFunction.php
注:本文中的Functions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论