本文整理汇总了PHP中Widgets::get_filename方法的典型用法代码示例。如果您正苦于以下问题:PHP Widgets::get_filename方法的具体用法?PHP Widgets::get_filename怎么用?PHP Widgets::get_filename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widgets
的用法示例。
在下文中一共展示了Widgets::get_filename方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Widgets
<div id='title' class='portlet-header'>";
echo $title;
echo "<div class='minimize'></div></div>
<div id='information' class='portlet-content'>";
echo $widget->get_content();
echo "</div>
</div>";
}
}
}
echo "</div>";*/
print "<script language='javascript'>\n\$(function() {";
foreach ($userWidgets as $widgetID => $userID) {
$curWidgetInfo = new Widgets($widgetID);
$widgetClass = $curWidgetInfo->get_class_name();
$phpFile = $curWidgetInfo->get_filename();
$fh = fopen($phpFile, 'r');
$data = fread($fh, filesize($phpFile));
fclose($fh);
if (!preg_match("/echo /i", $data) && !preg_match("/print /i", $data)) {
// if (preg_match
if (class_exists($widgetClass)) {
$widget = new $widgetClass();
} else {
print "\$(\"#id" . $widgetID . "\").html(\"Your class, \"" . $widgetClass . "\", taken from the database does not exist in your php file\");";
}
if (method_exists($widget, 'get_content')) {
if ($widget->get_content() != '') {
echo "\$(\"#id" . $widgetID . "\").load(\"loadPortlet.php?widget=" . $widgetID . "\");";
}
} else {
示例2: DashboardUsers
<?php
include_once "sessionCheck.php";
include_once "classes/Widgets.php";
$userID = $_SESSION['userid'];
$curUser = new DashboardUsers($userID);
$userWidgets = $curUser->get_users_widgets();
if ($userWidgets != '') {
foreach ($userWidgets as $widgetID => $userID) {
if ($_GET['widget'] == $widgetID) {
$curWidgetInfo = new Widgets($widgetID);
$filename = $curWidgetInfo->get_filename();
if (file_exists($filename)) {
include_once $filename;
$widgetClass = $curWidgetInfo->get_class_name();
if (class_exists($widgetClass)) {
$widget = new $widgetClass();
if (method_exists($widget, 'get_content')) {
echo $widget->get_content();
} else {
echo "No Content to retrieve";
}
}
}
}
}
}
示例3: checkDirForWidget
function checkDirForWidget($dir)
{
$process = true;
$error;
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$index = 0;
while (($file = readdir($dh)) !== false) {
if (!preg_match("/\\./", $file)) {
//checkDirForWidget($dir.$file."/");
$filename = $dir . $file . "/widget.php";
$configPath = $dir . $file . "/config.xml";
$xml = simplexml_load_file($configPath);
$className = $xml->className;
$name = $xml->name;
$description = $xml->description;
$version = $xml->version;
$title = $xml->title;
if (isset($className) && $className != "") {
$allWidgets = Widgets::get_widgets();
$exists = false;
foreach ($allWidgets as $id => $value) {
$tempWidget = new Widgets($id);
if ($tempWidget->get_filename() == $filename) {
$exists = true;
$widget = new Widgets($id);
}
}
if (!$exists) {
$widget = new Widgets();
}
$widget->set_name($name);
$widget->set_description($description);
$widget->set_filename($filename);
$widget->set_class_name($className);
$widget->set_conf_path($configPath);
$widget->set_version($version);
if (!$exists) {
if ($widget->insert_widget()) {
$process = true;
} else {
$error = $widget->get_error();
$process = false;
break;
}
} else {
if ($widget->update_widget()) {
$process = true;
} else {
$error = $widget->get_error();
$process = false;
break;
}
}
}
}
if ($index > 9999) {
break;
}
}
closedir($dh);
}
}
if ($process) {
return true;
} else {
return $error;
}
}