function pie_before_tool_render($params, &$result) { static $prefix_was_rendered = array(); static $temp_id = 0; $tool_name = $params['tool_name']; $pie_options = $params['pie_options']; $prefix = implode('_', explode('/', $tool_name)) . '_'; $id = isset($pie_options['id']) ? $pie_options['id'] : ''; if (!empty($id)) { $prefix = 'id' . $id . '_' . $prefix; } if (isset($pie_options['prefix'])) { $cur_prefix = $pie_options['prefix']; } else { $cur_prefix = Pie_Html::getIdPrefix(); } $tool_prefix = $cur_prefix . $prefix; if (isset($prefix_was_rendered[$tool_prefix])) { trigger_error("A tool with prefix \"{$tool_prefix}\" was already rendered.", E_USER_NOTICE); } $prefix_was_rendered[$tool_prefix] = true; $prev_prefix = Pie_Html::pushIdPrefix($tool_prefix); // other parameters: // script, notReady, id $pie_prefix = $prefix; $result = compact('pie_prefix'); }
<?php if ($upload) { echo Pie_Html::form($action_uri, 'post', array('id' => 'form', 'enctype' => 'multipart/form-data')); ?> <?php echo Pie_Html::formInfo($on_success); ?> <div class='items_addPhoto_tool_upload pie_choice'> <h2>Upload</h2> <div class="items_addPhoto_tool_certify"> By uploading, you certify that you have the right to distribute the image and that it does not violate the Terms of Service. </div> <div class='items_addPhoto_tool_photo_uploader'> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="2000000" /> <input type="hidden" name="uniqid" value="<?php echo $upload; ?> " /> <input name="upload" type="file" id="<?php echo Pie_Html::getIdPrefix(); ?> upload" class="file" accept="image/gif,image/jpeg,image/png" /> </div> </div> </form> <?php }