Skip to content
This repository has been archived by the owner on Mar 17, 2018. It is now read-only.

Commit

Permalink
Replaced global variable $data with $smof_data.
Browse files Browse the repository at this point in the history
  • Loading branch information
awps committed Mar 28, 2013
1 parent 0ca6c7c commit d4af105
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 47 deletions.
64 changes: 32 additions & 32 deletions admin/classes/class.options_machine.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function __construct($options) {
*/
public static function optionsframework_machine($options) {

$data = get_option(OPTIONS);
$smof_data = get_option(OPTIONS);

$defaults = array();
$counter = 0;
Expand Down Expand Up @@ -72,7 +72,7 @@ public static function optionsframework_machine($options) {
//hide items in checkbox group
$fold='';
if (array_key_exists("fold",$value)) {
if ($data[$value['fold']]) {
if ($smof_data[$value['fold']]) {
$fold="f_".$value['fold']." ";
} else {
$fold="f_".$value['fold']." temphide ";
Expand All @@ -95,7 +95,7 @@ public static function optionsframework_machine($options) {
//text input
case 'text':
$t_value = '';
$t_value = stripslashes($data[$value['id']]);
$t_value = stripslashes($smof_data[$value['id']]);

$mini ='';
if(!isset($value['mod'])) $value['mod'] = '';
Expand All @@ -112,7 +112,7 @@ public static function optionsframework_machine($options) {
$output .= '<div class="select_wrapper ' . $mini . '">';
$output .= '<select class="select of-input" name="'.$value['id'].'" id="'. $value['id'] .'">';
foreach ($value['options'] as $select_ID => $option) {
$output .= '<option id="' . $select_ID . '" value="'.$option.'" ' . selected($data[$value['id']], $option, false) . ' />'.$option.'</option>';
$output .= '<option id="' . $select_ID . '" value="'.$option.'" ' . selected($smof_data[$value['id']], $option, false) . ' />'.$option.'</option>';
}
$output .= '</select></div>';
break;
Expand All @@ -129,34 +129,34 @@ public static function optionsframework_machine($options) {
}
}

$ta_value = stripslashes($data[$value['id']]);
$ta_value = stripslashes($smof_data[$value['id']]);
$output .= '<textarea class="of-input" name="'.$value['id'].'" id="'. $value['id'] .'" cols="'. $cols .'" rows="8">'.$ta_value.'</textarea>';
break;

//radiobox option
case "radio":
$checked = (isset($data[$value['id']])) ? checked($data[$value['id']], $option, false) : '';
$checked = (isset($smof_data[$value['id']])) ? checked($smof_data[$value['id']], $option, false) : '';
foreach($value['options'] as $option=>$name) {
$output .= '<input class="of-input of-radio" name="'.$value['id'].'" type="radio" value="'.$option.'" ' . checked($data[$value['id']], $option, false) . ' /><label class="radio">'.$name.'</label><br/>';
$output .= '<input class="of-input of-radio" name="'.$value['id'].'" type="radio" value="'.$option.'" ' . checked($smof_data[$value['id']], $option, false) . ' /><label class="radio">'.$name.'</label><br/>';
}
break;

//checkbox option
case 'checkbox':
if (!isset($data[$value['id']])) {
$data[$value['id']] = 0;
if (!isset($smof_data[$value['id']])) {
$smof_data[$value['id']] = 0;
}

$fold = '';
if (array_key_exists("folds",$value)) $fold="fld ";

$output .= '<input type="hidden" class="'.$fold.'checkbox of-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="0"/>';
$output .= '<input type="checkbox" class="'.$fold.'checkbox of-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="1" '. checked($data[$value['id']], 1, false) .' />';
$output .= '<input type="checkbox" class="'.$fold.'checkbox of-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="1" '. checked($smof_data[$value['id']], 1, false) .' />';
break;

//multiple checkbox option
case 'multicheck':
(isset($data[$value['id']]))? $multi_stored = $data[$value['id']] : $multi_stored="";
(isset($smof_data[$value['id']]))? $multi_stored = $smof_data[$value['id']] : $multi_stored="";

foreach ($value['options'] as $key => $option) {
if (!isset($multi_stored[$key])) {$multi_stored[$key] = '';}
Expand All @@ -182,14 +182,14 @@ public static function optionsframework_machine($options) {

//colorpicker option
case 'color':
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: '.$data[$value['id']].'"></div></div>';
$output .= '<input class="of-color" name="'.$value['id'].'" id="'. $value['id'] .'" type="text" value="'. $data[$value['id']] .'" />';
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: '.$smof_data[$value['id']].'"></div></div>';
$output .= '<input class="of-color" name="'.$value['id'].'" id="'. $value['id'] .'" type="text" value="'. $smof_data[$value['id']] .'" />';
break;

//typography option
case 'typography':

$typography_stored = isset($data[$value['id']]) ? $data[$value['id']] : $value['std'];
$typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];

/* Font Size */

Expand Down Expand Up @@ -273,7 +273,7 @@ public static function optionsframework_machine($options) {
case 'border':

/* Border Width */
$border_stored = $data[$value['id']];
$border_stored = $smof_data[$value['id']];

$output .= '<div class="select_wrapper border-width">';
$output .= '<select class="of-border of-border-width select" name="'.$value['id'].'[width]" id="'. $value['id'].'_width">';
Expand Down Expand Up @@ -307,7 +307,7 @@ public static function optionsframework_machine($options) {

$i = 0;

$select_value = (isset($data[$value['id']])) ? $data[$value['id']] : '';
$select_value = (isset($smof_data[$value['id']])) ? $smof_data[$value['id']] : '';

foreach ($value['options'] as $key => $option)
{
Expand Down Expand Up @@ -358,7 +358,7 @@ public static function optionsframework_machine($options) {
$int = '';
$int = optionsframework_mlu_get_silentpost( $_id );
$output .= '<div class="slider"><ul id="'.$value['id'].'" rel="'.$int.'">';
$slides = $data[$value['id']];
$slides = $smof_data[$value['id']];
$count = count($slides);
if ($count < 2) {
$oldorder = 1;
Expand All @@ -381,7 +381,7 @@ public static function optionsframework_machine($options) {
//drag & drop block manager
case 'sorter':

$sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
$sortlists = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];

$output .= '<div id="'.$value['id'].'" class="sorter">';

Expand Down Expand Up @@ -419,7 +419,7 @@ public static function optionsframework_machine($options) {
case 'tiles':

$i = 0;
$select_value = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : '';
$select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';

foreach ($value['options'] as $key => $option)
{
Expand Down Expand Up @@ -464,7 +464,7 @@ public static function optionsframework_machine($options) {
case 'transfer':

$instructions = $value['desc'];
$output .= '<textarea id="export_data" rows="8">'.base64_encode(serialize($data)) /* 100% safe - ignore theme check nag */ .'</textarea>'."\n";
$output .= '<textarea id="export_data" rows="8">'.base64_encode(serialize($smof_data)) /* 100% safe - ignore theme check nag */ .'</textarea>'."\n";
$output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';

break;
Expand All @@ -474,7 +474,7 @@ public static function optionsframework_machine($options) {
$output .= '<div class="select_wrapper">';
$output .= '<select class="select of-input google_font_select" name="'.$value['id'].'" id="'. $value['id'] .'">';
foreach ($value['options'] as $select_key => $option) {
$output .= '<option value="'.$select_key.'" ' . selected((isset($data[$value['id']]))? $data[$value['id']] : "", $option, false) . ' />'.$option.'</option>';
$output .= '<option value="'.$select_key.'" ' . selected((isset($smof_data[$value['id']]))? $smof_data[$value['id']] : "", $option, false) . ' />'.$option.'</option>';
}
$output .= '</select></div>';

Expand All @@ -496,7 +496,7 @@ public static function optionsframework_machine($options) {
case 'sliderui':
$s_val = $s_min = $s_max = $s_step = $s_edit = '';//no errors, please

$s_val = stripslashes($data[$value['id']]);
$s_val = stripslashes($smof_data[$value['id']]);

if(!isset($value['min'])){ $s_min = '0'; }else{ $s_min = $value['min']; }
if(!isset($value['max'])){ $s_max = $s_min + 1; }else{ $s_max = $value['max']; }
Expand Down Expand Up @@ -524,8 +524,8 @@ public static function optionsframework_machine($options) {

//Switch option
case 'switch':
if (!isset($data[$value['id']])) {
$data[$value['id']] = 0;
if (!isset($smof_data[$value['id']])) {
$smof_data[$value['id']] = 0;
}

$fold = '';
Expand All @@ -534,7 +534,7 @@ public static function optionsframework_machine($options) {
$cb_enabled = $cb_disabled = '';//no errors, please

//Get selected
if ($data[$value['id']] == 1){
if ($smof_data[$value['id']] == 1){
$cb_enabled = ' selected';
$cb_disabled = '';
}else{
Expand All @@ -561,7 +561,7 @@ public static function optionsframework_machine($options) {
$output .= '<label class="'.$fold.'cb-disable'. $cb_disabled .'" data-id="'.$value['id'].'"><span>'. $off .'</span></label>';

$output .= '<input type="hidden" class="'.$fold.'checkbox of-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="0"/>';
$output .= '<input type="checkbox" id="'.$value['id'].'" class="'.$fold.'checkbox of-input main_checkbox" name="'.$value['id'].'" value="1" '. checked($data[$value['id']], 1, false) .' />';
$output .= '<input type="checkbox" id="'.$value['id'].'" class="'.$fold.'checkbox of-input main_checkbox" name="'.$value['id'].'" value="1" '. checked($smof_data[$value['id']], 1, false) .' />';

$output .= '</p>';

Expand Down Expand Up @@ -599,10 +599,10 @@ public static function optionsframework_machine($options) {
*/
public static function optionsframework_uploader_function($id,$std,$mod){

$data =get_option(OPTIONS);
$smof_data =get_option(OPTIONS);

$uploader = '';
$upload = $data[$id];
$upload = $smof_data[$id];
$hide = '';

if ($mod == "min") {$hide ='hide';}
Expand Down Expand Up @@ -642,10 +642,10 @@ public static function optionsframework_uploader_function($id,$std,$mod){
*/
public static function optionsframework_media_uploader_function($id,$std,$int,$mod){

$data =get_option(OPTIONS);
$smof_data =get_option(OPTIONS);

$uploader = '';
$upload = $data[$id];
$upload = $smof_data[$id];
$hide = '';

if ($mod == "min") {$hide ='hide';}
Expand Down Expand Up @@ -684,11 +684,11 @@ public static function optionsframework_media_uploader_function($id,$std,$int,$m
*/
public static function optionsframework_slider_function($id,$std,$oldorder,$order,$int){

$data = get_option(OPTIONS);
$smof_data = get_option(OPTIONS);

$slider = '';
$slide = array();
$slide = $data[$id];
$slide = $smof_data[$id];

if (isset($slide[$oldorder])) { $val = $slide[$oldorder]; } else {$val = $std;}

Expand Down
2 changes: 1 addition & 1 deletion admin/functions/functions.admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ function of_get_header_classes_array()
*
* @since forever
*/
$data = get_option(OPTIONS);
$smof_data = get_option(OPTIONS);
22 changes: 11 additions & 11 deletions admin/functions/functions.interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ function optionsframework_options_page(){
global $options_machine;
/*
//for debugging
$data = get_option(OPTIONS);
print_r($data);
$smof_data = get_option(OPTIONS);
print_r($smof_data);
*/

include_once( ADMIN_PATH . 'front-end/options.php' );
Expand Down Expand Up @@ -213,26 +213,26 @@ function of_ajax_callback()
elseif($save_type == 'restore_options')
{

$data = get_option(BACKUPS);
$smof_data = get_option(BACKUPS);

update_option(OPTIONS, $data);
update_option(OPTIONS, $smof_data);

die('1');
}
elseif($save_type == 'import_options'){

$data = $_POST['data'];
$data = unserialize(base64_decode($data)); //100% safe - ignore theme check nag
update_option(OPTIONS, $data);
$smof_data = $_POST['data'];
$smof_data = unserialize(base64_decode($smof_data)); //100% safe - ignore theme check nag
update_option(OPTIONS, $smof_data);

die('1');
}
elseif ($save_type == 'save')
{
wp_parse_str(stripslashes($_POST['data']), $data);
unset($data['security']);
unset($data['of_save']);
update_option(OPTIONS, $data);
wp_parse_str(stripslashes($_POST['data']), $smof_data);
unset($smof_data['security']);
unset($smof_data['of_save']);
update_option(OPTIONS, $smof_data);

die('1');
}
Expand Down
6 changes: 3 additions & 3 deletions template-debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
?>
<pre>
<?php
$data_r = print_r($data, true);
$data_r_sans = htmlspecialchars($data_r, ENT_QUOTES);
echo $data_r_sans; ?>
$smof_data_r = print_r($smof_data, true);
$smof_data_r_sans = htmlspecialchars($smof_data_r, ENT_QUOTES);
echo $smof_data_r_sans; ?>
</pre>

<?php get_footer(); ?>

0 comments on commit d4af105

Please sign in to comment.