-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes from our local development merged back to the community.
- Loading branch information
Showing
8 changed files
with
368 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<?php | ||
|
||
if(!class_exists('Object')) { | ||
class Object { | ||
|
||
var $creation_time; | ||
|
||
function debug($msg = '', $forced = false) | ||
{ | ||
$run_time = microtime(true) - $this->creation_time; | ||
$otype = get_class($this); | ||
|
||
ob_start(); | ||
if($msg) | ||
print_r($msg); | ||
$result = ob_get_contents(); | ||
ob_end_clean(); | ||
|
||
echo "<pre>$otype DEBUG [$run_time]: "; | ||
echo htmlentities($result); | ||
echo "\n</pre>"; | ||
|
||
} | ||
|
||
/** | ||
* Function to allow setting of internal object values. | ||
*/ | ||
function vset( $variable, $value = '' ) | ||
{ | ||
if(!isset($this->$variable)) | ||
return(false); | ||
else { | ||
if($this->$variable !== $value) | ||
{ | ||
$this->$variable = $value; | ||
} | ||
return(true); | ||
} | ||
} | ||
|
||
/** | ||
* Function to return or print the current object as a string. | ||
*/ | ||
function toString($print = true) | ||
{ | ||
$result = ""; | ||
|
||
if(ob_start()) | ||
{ | ||
$this->debug($this); | ||
$result = ob_get_contents(); | ||
ob_end_clean(); | ||
} | ||
else | ||
{ | ||
foreach($this as $key=>$value) | ||
{ | ||
$result .= $key . ": " . $value . "\n"; | ||
} | ||
} | ||
|
||
if($print) echo $result; | ||
return($result); | ||
} | ||
|
||
function copyToObj( $target ) | ||
{ | ||
foreach($this as $property=>$value) | ||
{ | ||
$target->$property = $value; | ||
} | ||
return(true); | ||
} | ||
|
||
function error($msg) | ||
{ | ||
trigger_error($msg, E_USER_ERROR); | ||
} | ||
|
||
function warning($msg) | ||
{ | ||
trigger_error($msg, E_USER_WARNING); | ||
} | ||
|
||
/** | ||
* Standard PHP5 Constructor | ||
*/ | ||
function __construct() | ||
{ | ||
$this->creation_time = microtime(true); | ||
# $this->debug('Created New ' . get_class($this)); | ||
} | ||
|
||
/** | ||
* Standard PHP5 Destructor | ||
*/ | ||
function __destruct() | ||
{ | ||
} | ||
|
||
/** | ||
* PHP4 style constructor | ||
* | ||
* This PHP4 style constructor will only be called by a system running PHP4. It will register the | ||
* PHP5 style destructor for running on shutdown, and will proceed to run the PHP5 style constructor | ||
* manually. | ||
* | ||
*/ | ||
function Object() { | ||
// register __destruct method as shutdown function | ||
if(function_exists('register_shutdown_function')) | ||
register_shutdown_function(array(&$this, "__destruct")); | ||
else | ||
trigger_error("Shutdown function does not exist.", E_USER_ERROR); | ||
|
||
return($this->__construct()); | ||
} | ||
|
||
} | ||
} | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php formbuilder_admin_nav('export form'); ?> | ||
|
||
<h3 class="info-box-title"><?php _e('Form Export', 'formbuilder'); ?></h3> | ||
<p><?php _e('The following text contains the data required to move this form to another site. To move it, copy the entire text and paste it into the Import Form box on your secondary site.', 'formbuilder'); ?></p> | ||
<textarea style="width: 700px; height: 500px;"><?php echo $formData; ?></textarea> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php formbuilder_admin_nav('import form'); ?> | ||
|
||
<form name="formImport" method="POST" action="<?php echo FB_ADMIN_PLUGIN_PATH; ?>&fbaction=importForm"> | ||
<h3 class="info-box-title"><?php _e('Form Import', 'formbuilder'); ?></h3> | ||
<p><?php _e('Enter the exported form data here and press Save.', 'formbuilder'); ?></p> | ||
<textarea style="width: 700px; height: 500px;" name="formData"><?php echo $formData; ?></textarea> | ||
<br/><input type="submit" name="submit" value="Save" /> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.