$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; } $output .= "\t\t<b>" . __("Post will be submitted with these tags:", "tdomf") . "</b>\n\t\t<br/>\n\t\t<?php echo \$tags; ?>\n"; $output .= "\t<?php } ?>"; $output .= $after_widget; } return $output; } tdomf_register_form_widget_preview_hack('tags', __('Tags', 'tdomf'), 'tdomf_widget_tags_preview_hack', array("new-post")); /////////////////////////////////////////////////////////// // Show what tags are on the post to admins for moderating // function tdomf_widget_tags_adminemail($args) { extract($args); $tags = wp_get_post_tags($post_ID); if (!empty($tags)) { $output = $before_widget; $output .= __("Post tagged with\r\n", "tdomf"); foreach ($tags as $tag) { $output .= $tag->name . ", "; } $output .= $after_widget; return $output;
} if ($options['user-pings']) { if ($options['user-comments']) { $output .= "\n\t\t<br/>"; } $output .= "\n\t<?php if(isset(\$post_args['comments-user-pings'])) { ?>\n\t\t"; $output .= __("Pings and Trackbacks will be enabled for this submission", "tdomf"); $output .= "\n\t<?php } else { ?>\n\t\t"; $output .= __("Pings and Trackbacks will be disabled for this submission", "tdomf"); $output .= "\n\t<?php } ?>"; } $output .= $after_widget; } return $output; } tdomf_register_form_widget_preview_hack('comments', __('Comments Management', "tdomf"), 'tdomf_widget_comments_preview_hack', $modes = array('new')); function tdomf_widget_comments_adminemail($args) { $options = tdomf_widget_comments_get_options($args['tdomf_form_id']); extract($args); $output = ""; $post = wp_get_single_post($post_ID, ARRAY_A); if ($post['comment_status'] == 'closed') { $output .= __("Comments off", "tdomf"); } else { $output .= __("Comments on", "tdomf"); } $output .= "\n"; if ($post['ping_status'] == 'closed') { $output .= __("Pings and Trackbacks off", "tdomf"); } else {
/** * 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); } } }