extract($args); $options = tdomf_widget_tags_options($tdomf_form_id); if ($options['user']) { if (isset($tags) && !empty($tags)) { $output = $before_widget; if ($options['title'] != '') { $output .= $before_title . $options['title'] . $after_title; } $output .= sprintf(__("<b>Post will be sumbmitted with these tags</b>:<br/>%s", "tdomf"), strip_tags($tags)); $output .= $after_widget; return $output; } } return ""; } tdomf_register_form_widget_preview('tags', __('Tags', 'tdomf'), 'tdomf_widget_tags_preview', array("new-post")); //////////////////////// // Hack the Preview tags // function tdomf_widget_tags_preview_hack($args) { extract($args); $options = tdomf_widget_tags_options($tdomf_form_id); $output = ""; if ($options['user']) { $output = $before_widget; $output .= "\t<?php \$tags = strip_tags(trim(\$tags));\n"; $output .= "\tif(!empty(\$tags)) { ?>\n"; if ($options['title'] != '') { $output .= $before_title . $options['title'] . $after_title; }
} if ($options['user-pings']) { if ($options['user-comments']) { $output .= "<br/>"; } if (isset($args["comments-user-pings"])) { $output .= __("Pings and Trackbacks will be enabled for this submission", "tdomf"); } else { $output .= __("Pings and Trackbacks will be disabled for this submission", "tdomf"); } } $output .= $after_widget; } return $output; } tdomf_register_form_widget_preview('comments', __('Comments Management', "tdomf"), 'tdomf_widget_comments_preview', $modes = array('new')); function tdomf_widget_comments_preview_hack($args) { extract($args); $options = tdomf_widget_comments_get_options($args['tdomf_form_id']); $output = ""; if ($options['user-comments'] || $options['user-pings']) { extract($args); $output = $before_widget; if (!empty($options['title'])) { $output .= $before_title; $output .= $options['title']; $output .= $after_title; } if ($options['user-comments']) { $output .= "\n\t<?php if(isset(\$post_args['comments-user-comments'])) { ?>\n\t\t";
/** * Start widget * * @access public */ function start() { $retVal = false; if (!$this->started || !$this->internalName || !$this->displayName) { $retVal = true; if ($this->multipleInstances) { add_action('tdomf_generate_form_start', array($this, '_multipleInstancesInit'), 10, 2); add_action('tdomf_create_post_start', array($this, '_multipleInstancesInit'), 10, 2); add_action('tdomf_control_form_start', array($this, '_multipleInstancesInit'), 10, 2); add_action('tdomf_preview_form_start', array($this, '_multipleInstancesInit'), 10, 2); add_action('tdomf_validate_form_start', array($this, '_multipleInstancesInit'), 10, 2); add_action('tdomf_control_form_start', array($this, '_multipleInstancesHandler'), 10, 2); add_action('tdomf_widget_page_bottom', array($this, '_multipleInstancesForm'), 10, 2); add_action('tdomf_upload_inline_form_start', array($this, '_multipleInstancesInit'), 10, 2); // for multiple instances, init is handled in _multipleInstancesInit function } else { tdomf_register_form_widget($this->internalName, $this->displayName, array($this, '_form'), $this->modes); if ($this->hack) { tdomf_register_form_widget_hack($this->internalName, $this->displayName, array($this, '_formHack'), $this->modes); } if ($this->control) { tdomf_register_form_widget_control($this->internalName, $this->displayName, array($this, '_control'), $this->controlWidth, $this->controlHeight, $this->modes); } if ($this->preview) { tdomf_register_form_widget_preview($this->internalName, $this->displayName, array($this, '_preview'), $this->modes); } if ($this->previewHack) { tdomf_register_form_widget_preview_hack($this->internalName, $this->displayName, array($this, '_previewHack'), $this->modes); } if ($this->validate) { tdomf_register_form_widget_validate($this->internalName, $this->displayName, array($this, '_validate'), $this->modes); } if ($this->post) { tdomf_register_form_widget_post($this->internalName, $this->displayName, array($this, '_post'), $this->modes); } if ($this->adminEmail) { tdomf_register_form_widget_adminemail($this->internalName, $this->displayName, array($this, '_adminEmail'), $this->modes); } if ($this->adminError) { tdomf_register_form_widget_admin_error($this->internalName, $this->displayName, array($this, '_adminError'), $this->modes); } } } return $retVal; }
function tdomf_widget_categories_init($form_id, $mode) { if (tdomf_form_exists($form_id) && strpos($mode, 'new-post') !== false) { $count = tdomf_get_option_widget('tdomf_categories_widget_count', $form_id); $max = tdomf_get_option_form(TDOMF_OPTION_WIDGET_INSTANCES, $form_id); if ($max <= 1) { $count = 1; } else { if ($count > $max + 1) { $count = $max + 1; } } tdomf_register_form_widget("categories", "Categories 1", 'tdomf_widget_categories', array(), 1); tdomf_register_form_widget_hack("categories", "Categories 1", 'tdomf_widget_categories', array(), 1); tdomf_register_form_widget_control("categories", "Categories 1", 'tdomf_widget_categories_control', 370, 610, array(), 1); tdomf_register_form_widget_preview("categories", "Categories 1", 'tdomf_widget_categories_preview', array(), 1); tdomf_register_form_widget_preview_hack("categories", "Categories 1", 'tdomf_widget_categories_preview_hack', array(), 1); tdomf_register_form_widget_post("categories", "Categories 1", 'tdomf_widget_categories_post', array(), 1); tdomf_register_form_widget_adminemail("categories", "Categories 1", 'tdomf_widget_categories_adminemail', array(), 1); tdomf_register_form_widget_admin_error("categories", "Categories 1", 'tdomf_widget_categories_admin_error', array(), 1); for ($i = 2; $i <= $count; $i++) { tdomf_register_form_widget("categories-{$i}", "Categories {$i}", 'tdomf_widget_categories', array(), $i); tdomf_register_form_widget_hack("categories-{$i}", "Categories {$i}", 'tdomf_widget_categories', array(), $i); tdomf_register_form_widget_control("categories-{$i}", "Categories {$i}", 'tdomf_widget_categories_control', 370, 610, array(), $i); tdomf_register_form_widget_preview("categories-{$i}", "Categories {$i}", 'tdomf_widget_categories_preview', array(), $i); tdomf_register_form_widget_preview_hack("categories-{$i}", "Categories {$i}", 'tdomf_widget_categories_preview_hack', array(), $i); tdomf_register_form_widget_post("categories-{$i}", "Categories {$i}", 'tdomf_widget_categories_post', array(), $i); tdomf_register_form_widget_adminemail("categories-{$i}", "Categories {$i}", 'tdomf_widget_categories_adminemail', array(), $i); tdomf_register_form_widget_admin_error("categories-{$i}", "Categories {$i}", 'tdomf_widget_categories_admin_error', array(), $i); } } }