function poll_edit_form($poll_id = 1) { $poll_id = (int) $poll_id; $polldaddy = $this->get_client(WP_POLLDADDY__PARTNERGUID, $this->user_code); $polldaddy->reset(); $is_POST = 'post' == strtolower($_SERVER['REQUEST_METHOD']); if ($poll_id) { $poll = $polldaddy->get_poll($poll_id); $this->parse_errors($polldaddy); if (!$this->can_edit($poll)) { $this->errors->add('permission', __('You are not allowed to edit this poll.', 'polldaddy')); } if ($poll_id == 1) { $poll->answers = array(); $poll_id = 0; } } else { $poll = polldaddy_poll(array(), null, false); } $question = $is_POST ? attribute_escape(stripslashes($_POST['question'])) : attribute_escape($poll->question); $this->print_errors(); ?> <form action="" method="post"> <div id="poststuff"><div id="post-body" class="has-sidebar has-right-sidebar"> <div class="inner-sidebar" id="side-info-column"> <div id="submitdiv" class="postbox"> <h3><?php _e('Publish', 'polldaddy'); ?> </h3> <div class="inside"> <div id="major-publishing-actions"> <p id="publishing-action"> <?php wp_nonce_field($poll_id ? "edit-poll_{$poll_id}" : 'create-poll'); ?> <input type="hidden" name="action" value="<?php echo $poll_id ? 'edit-poll' : 'create-poll'; ?> " /> <input type="hidden" class="polldaddy-poll-id" name="poll" value="<?php echo $poll_id; ?> " /> <input type="submit" class="button-primary" value="<?php echo attribute_escape(__('Save Poll', 'polldaddy')); ?> " /> <?php if (isset($_GET['iframe']) && $poll_id) { ?> <input type="button" class="button polldaddy-send-to-editor" value="<?php echo attribute_escape(__('Send to Editor', 'polldaddy')); ?> " /> <?php } ?> </p> <br class="clear" /> </div> </div> </div> <div class="postbox"> <h3><?php _e('Poll results', 'polldaddy'); ?> </h3> <div class="inside"> <ul class="poll-options"> <?php foreach (array('show' => __('Show results to voters', 'polldaddy'), 'percent' => __('Only show percentages', 'polldaddy'), 'hide' => __('Hide all results', 'polldaddy')) as $value => $label) { if ($is_POST) { $checked = $value === $_POST['resultsType'] ? ' checked="checked"' : ''; } else { $checked = $value === $poll->resultsType ? ' checked="checked"' : ''; } ?> <li> <label for="resultsType-<?php echo $value; ?> "><input type="radio"<?php echo $checked; ?> value="<?php echo $value; ?> " name="resultsType" id="resultsType-<?php echo $value; ?> " /> <?php echo wp_specialchars($label); ?> </label> </li> <?php } ?> </ul> </div> </div> <div class="postbox"> <h3><?php _e('Block repeat voters', 'polldaddy'); ?> </h3> <div class="inside"> <ul class="poll-options"> <?php foreach (array('off' => __("Don't block repeat voters", 'polldaddy'), 'cookie' => __('Block by cookie (recommended)', 'polldaddy'), 'cookieip' => __('Block by cookie and by IP address', 'polldaddy')) as $value => $label) { if ($is_POST) { $checked = $value === $_POST['blockRepeatVotersType'] ? ' checked="checked"' : ''; } else { $checked = $value === $poll->blockRepeatVotersType ? ' checked="checked"' : ''; } ?> <li> <label for="blockRepeatVotersType-<?php echo $value; ?> "><input class="block-repeat" type="radio"<?php echo $checked; ?> value="<?php echo $value; ?> " name="blockRepeatVotersType" id="blockRepeatVotersType-<?php echo $value; ?> " /> <?php echo wp_specialchars($label); ?> </label> </li> <?php } ?> </ul> <span style="margin:6px 6px 8px;" id="cookieip_expiration_label"><label><?php _e('Expires: ', 'polldaddy'); ?> </label></span> <select id="cookieip_expiration" name="cookieip_expiration" style="width: auto;<?php echo $poll->blockRepeatVotersType == 'off' ? 'display:none;' : ''; ?> "> <option value="0" <?php echo (int) $poll->blockExpiration == 0 ? 'selected' : ''; ?> ><?php _e('Never', 'polldaddy'); ?> </option> <option value="3600" <?php echo (int) $poll->blockExpiration == 3600 ? 'selected' : ''; ?> ><?php printf(__('%d hour', 'polldaddy'), 1); ?> </option> <option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected' : ''; ?> ><?php printf(__('%d hours', 'polldaddy'), 3); ?> </option> <option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected' : ''; ?> ><?php printf(__('%d hours', 'polldaddy'), 6); ?> </option> <option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected' : ''; ?> ><?php printf(__('%d hours', 'polldaddy'), 12); ?> </option> <option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected' : ''; ?> ><?php printf(__('%d day', 'polldaddy'), 1); ?> </option> <option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected' : ''; ?> ><?php printf(__('%d week', 'polldaddy'), 1); ?> </option> <option value="2419200" <?php echo (int) $poll->blockExpiration == 2419200 ? 'selected' : ''; ?> ><?php printf(__('%d month', 'polldaddy'), 1); ?> </option> </select> <p><?php _e('Note: Blocking by cookie and IP address can be problematic for some voters.', 'polldaddy'); ?> </p> </div> </div> </div> <div id="post-body-content" class="has-sidebar-content"> <div id="titlediv"> <div id="titlewrap"> <input type="text" autocomplete="off" id="title" value="<?php echo $question; ?> " tabindex="1" size="30" name="question" /> </div> </div> <div id="answersdiv" class="postbox"> <h3><?php _e('Answers', 'polldaddy'); ?> </h3> <div id="answerswrap" class="inside"> <ul id="answers"> <?php $a = 0; $answers = array(); if ($is_POST && $_POST['answer']) { foreach ($_POST['answer'] as $answer_id => $answer) { $answers[attribute_escape($answer_id)] = attribute_escape(stripslashes($answer)); } } elseif (isset($poll->answers->answer)) { foreach ($poll->answers->answer as $answer) { $answers[(int) $answer->_id] = attribute_escape($answer->text); } } foreach ($answers as $answer_id => $answer) { $a++; $delete_link = clean_url(wp_nonce_url(add_query_arg(array('action' => 'delete-answer', 'poll' => $poll_id, 'answer' => $answer_id, 'message' => false)), "delete-answer_{$answer_id}")); ?> <li> <span class="handle" title="<?php echo attribute_escape('click and drag to move'); ?> ">↕</span> <div><input type="text" autocomplete="off" id="answer-<?php echo $answer_id; ?> " value="<?php echo $answer; ?> " tabindex="2" size="30" name="answer[<?php echo $answer_id; ?> ]" /></div> <a href="<?php echo $delete_link; ?> " class="delete-answer delete" title="<?php echo attribute_escape('delete this answer'); ?> ">×</a> </li> <?php } while (3 - $a > 0) { $a++; ?> <li> <span class="handle" title="<?php echo attribute_escape('click and drag to move'); ?> ">↕</span> <div><input type="text" autocomplete="off" value="" tabindex="2" size="30" name="answer[new<?php echo $a; ?> ]" /></div> <a href="#" class="delete-answer delete" title="<?php echo attribute_escape('delete this answer'); ?> ">×</a> </li> <?php } ?> </ul> <p id="add-answer-holder"> <button class="button"><?php echo wp_specialchars(__('Add another', 'polldaddy')); ?> </button> </p> <ul id="answer-options"> <?php foreach (array('multipleChoice' => __('Multiple choice', 'polldaddy'), 'randomiseAnswers' => __('Randomize answer order', 'polldaddy'), 'otherAnswer' => __('Allow other answers', 'polldaddy'), 'sharing' => __("'Share This' link", 'polldaddy')) as $option => $label) { if ($is_POST) { $checked = 'yes' === $_POST[$option] ? ' checked="checked"' : ''; } else { $checked = 'yes' === $poll->{$option} ? ' checked="checked"' : ''; } ?> <li> <label for="<?php echo $option; ?> "><input type="checkbox"<?php echo $checked; ?> value="yes" id="<?php echo $option; ?> " name="<?php echo $option; ?> " /> <?php echo wp_specialchars($label); ?> </label> </li> <?php } ?> </ul> <?php if ($is_POST) { $style = 'yes' === $_POST['multipleChoice'] ? 'display:block;' : 'display:none;'; } else { $style = 'yes' === $poll->multipleChoice ? 'display:block;' : 'display:none;'; } ?> <div id="numberChoices" name="numberChoices" style="padding-left:15px;<?php echo $style; ?> "> <p>Number of choices: <select name="choices" id="choices"><option value="0">No Limit</option> <?php if ($is_POST) { $choices = (int) $_POST['choices']; } else { $choices = (int) $poll->choices; } if ($a > 1) { for ($i = 2; $i <= $a; $i++) { $selected = $i == $choices ? 'selected="true"' : ''; echo "<option value='{$i}' {$selected}>{$i}</option>"; } } ?> </select> </p> </div> </div> </div> <div id="design" class="postbox"> <?php $style_ID = (int) ($is_POST ? $_POST['styleID'] : $poll->styleID); $iframe_view = false; if (isset($_GET['iframe'])) { $iframe_view = true; } $options = array(101 => __('Aluminum Narrow', 'polldaddy'), 102 => __('Aluminum Medium', 'polldaddy'), 103 => __('Aluminum Wide', 'polldaddy'), 104 => __('Plain White Narrow', 'polldaddy'), 105 => __('Plain White Medium', 'polldaddy'), 106 => __('Plain White Wide', 'polldaddy'), 107 => __('Plain Black Narrow', 'polldaddy'), 108 => __('Plain Black Medium', 'polldaddy'), 109 => __('Plain Black Wide', 'polldaddy'), 110 => __('Paper Narrow', 'polldaddy'), 111 => __('Paper Medium', 'polldaddy'), 112 => __('Paper Wide', 'polldaddy'), 113 => __('Skull Dark Narrow', 'polldaddy'), 114 => __('Skull Dark Medium', 'polldaddy'), 115 => __('Skull Dark Wide', 'polldaddy'), 116 => __('Skull Light Narrow', 'polldaddy'), 117 => __('Skull Light Medium', 'polldaddy'), 118 => __('Skull Light Wide', 'polldaddy'), 157 => __('Micro', 'polldaddy'), 119 => __('Plastic White Narrow', 'polldaddy'), 120 => __('Plastic White Medium', 'polldaddy'), 121 => __('Plastic White Wide', 'polldaddy'), 122 => __('Plastic Grey Narrow', 'polldaddy'), 123 => __('Plastic Grey Medium', 'polldaddy'), 124 => __('Plastic Grey Wide', 'polldaddy'), 125 => __('Plastic Black Narrow', 'polldaddy'), 126 => __('Plastic Black Medium', 'polldaddy'), 127 => __('Plastic Black Wide', 'polldaddy'), 128 => __('Manga Narrow', 'polldaddy'), 129 => __('Manga Medium', 'polldaddy'), 130 => __('Manga Wide', 'polldaddy'), 131 => __('Tech Dark Narrow', 'polldaddy'), 132 => __('Tech Dark Medium', 'polldaddy'), 133 => __('Tech Dark Wide', 'polldaddy'), 134 => __('Tech Grey Narrow', 'polldaddy'), 135 => __('Tech Grey Medium', 'polldaddy'), 136 => __('Tech Grey Wide', 'polldaddy'), 137 => __('Tech Light Narrow', 'polldaddy'), 138 => __('Tech Light Medium', 'polldaddy'), 139 => __('Tech Light Wide', 'polldaddy'), 140 => __('Working Male Narrow', 'polldaddy'), 141 => __('Working Male Medium', 'polldaddy'), 142 => __('Working Male Wide', 'polldaddy'), 143 => __('Working Female Narrow', 'polldaddy'), 144 => __('Working Female Medium', 'polldaddy'), 145 => __('Working Female Wide', 'polldaddy'), 146 => __('Thinking Male Narrow', 'polldaddy'), 147 => __('Thinking Male Medium', 'polldaddy'), 148 => __('Thinking Male Wide', 'polldaddy'), 149 => __('Thinking Female Narrow', 'polldaddy'), 150 => __('Thinking Female Medium', 'polldaddy'), 151 => __('Thinking Female Wide', 'polldaddy'), 152 => __('Sunset Narrow', 'polldaddy'), 153 => __('Sunset Medium', 'polldaddy'), 154 => __('Sunset Wide', 'polldaddy'), 155 => __('Music Medium', 'polldaddy'), 156 => __('Music Wide', 'polldaddy')); $polldaddy->reset(); $styles = $polldaddy->get_styles(); $show_custom = false; if (!empty($styles) && !empty($styles->style) && count($styles->style) > 0) { foreach ((array) $styles->style as $style) { $options[(int) $style->_id] = $style->title; } $show_custom = true; } if ($style_ID > 18) { $standard_style_ID = 0; $custom_style_ID = $style_ID; } else { $standard_style_ID = $style_ID; $custom_style_ID = 0; } ?> <h3><?php _e('Design', 'polldaddy'); ?> </h3> <input type="hidden" name="styleID" id="styleID" value="<?php echo $style_ID; ?> "> <div class="inside"> <?php if ($iframe_view) { ?> <div id="design_standard" style="padding:0px;"> <div class="hide-if-no-js"> <table class="pollStyle"> <thead> <tr> <th> <div style="display:none;"> <input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/> </div> </th> </tr> </thead> <tr> <td class="selector"> <table class="st_selector"> <tr> <td class="dir_left"> <a href="javascript:pd_move('prev');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">«</a> </td> <td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td> <td class="dir_right"> <a href="javascript:pd_move('next');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">»</a> </td> </tr> <tr> <td></td> <td class="counter"> <div id="st_number"></div> </td> <td></td> </tr> <tr> <td></td> <td class="title"> <div id="st_name"></div> </td> <td></td> </tr> <tr> <td></td> <td> <div id="st_sizes"></div> </td> <td></td> </tr> <tr> <td colspan="3"> <div id="st_description"></div> </td> </tr> </table> </td> </tr> </table> </div> <p class="empty-if-js" id="no-js-styleID"> <select id="styleID" name="styleID"> <?php foreach ($options as $styleID => $label) { $selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?> <option value="<?php echo (int) $styleID; ?> "<?php echo $selected; ?> ><?php echo wp_specialchars($label); ?> </option> <?php } ?> </select> </p> </div> <?php if ($show_custom) { ?> <div id="design_custom"> <p class="hide-if-no-js"> <table class="pollStyle"> <thead> <tr> <th> <div style="display:none;"> <?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?> <input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style(_$('customSelect').value);" <?php echo $disabled; ?> ></input> <label onclick="javascript:pd_change_style(_$('customSelect').value);"><?php _e('Custom Style', 'polldaddy'); ?> </label> </div> </th> </tr> </thead> <tbody> <tr> <td class="customSelect"> <table> <tr> <td><?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?> <select id="customSelect" name="customSelect" onclick="pd_change_style(this.value);" <?php echo $hide; ?> > <?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?> <option value="x"<?php echo $selected; ?> ><?php _e('Please choose a custom style...', 'polldaddy'); ?> </option> <?php if ($show_custom) { foreach ((array) $styles->style as $style) { $selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?> <option value="<?php echo (int) $style->_id; ?> "<?php echo $selected; ?> ><?php echo wp_specialchars($style->title); ?> </option> <?php } } ?> </select> <div id="styleIDErr" class="formErr" style="display:none;"><?php _e('Please choose a style.', 'polldaddy'); ?> </div></td> </tr> <tr> <td><?php $extra = $show_custom == false ? __('You currently have no custom styles created.', 'polldaddy') : ''; ?> <p><?php echo $extra; ?> </p> <p><?php printf(__('Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.', 'polldaddy'), 'http://support.polldaddy.com/custom-poll-styles/'); ?> </p> </td> </tr> </table> </td> </tr> </tbody> </table> </p> </div> <div id="design_options"> <a href="#" class="polldaddy-show-design-options"><?php _e('Custom Styles', 'polldaddy'); ?> </a> </div> <?php } } else { ?> <div class="design_standard"> <div class="hide-if-no-js"> <table class="pollStyle"> <thead> <tr> <th class="cb"> <input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/> </th> <th> <label for="skin" onclick="javascript:pd_build_styles( 0 );"><?php _e('PollDaddy Style', 'polldaddy'); ?> </label> </th> <th/> <th class="cb"> <?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?> <input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style(_$('customSelect').value);" <?php echo $disabled; ?> ></input> </th> <th> <label onclick="javascript:pd_change_style(_$('customSelect').value);"><?php _e('Custom Style', 'polldaddy'); ?> </label> </th> </tr> </thead> <tbody> <tr> <td/> <td class="selector"> <table class="st_selector"> <tr> <td class="dir_left"> <a href="javascript:pd_move('prev');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">«</a> </td> <td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td> <td class="dir_right"> <a href="javascript:pd_move('next');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">»</a> </td> </tr> <tr> <td></td> <td class="counter"> <div id="st_number"></div> </td> <td></td> </tr> <tr> <td></td> <td class="title"> <div id="st_name"></div> </td> <td></td> </tr> <tr> <td></td> <td> <div id="st_sizes"></div> </td> <td></td> </tr> <tr> <td colspan="3"> <div id="st_description"></div> </td> </tr> </table> </td> <td width="100"></td> <td/> <td class="customSelect"> <table> <tr> <td><?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?> <select id="customSelect" name="customSelect" onclick="pd_change_style(this.value);" <?php echo $hide; ?> > <?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?> <option value="x"<?php echo $selected; ?> ><?php _e('Please choose a custom style...', 'polldaddy'); ?> </option> <?php if ($show_custom) { foreach ((array) $styles->style as $style) { $selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?> <option value="<?php echo (int) $style->_id; ?> "<?php echo $selected; ?> ><?php echo wp_specialchars($style->title); ?> </option> <?php } } ?> </select> <div id="styleIDErr" class="formErr" style="display:none;"><?php _e('Please choose a style.', 'polldaddy'); ?> </div></td> </tr> <tr> <td><?php $extra = $show_custom == false ? __('You currently have no custom styles created.', 'polldaddy') : ''; ?> <p><?php echo $extra; ?> </p> <p><?php printf(__('Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.', 'polldaddy'), 'http://support.polldaddy.com/custom-poll-styles/'); ?> </p> </td> </tr> </table> </td> </tr> </tbody> </table> </div> <p class="empty-if-js" id="no-js-styleID"> <select id="styleID" name="styleID"> <?php foreach ($options as $styleID => $label) { $selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?> <option value="<?php echo (int) $styleID; ?> "<?php echo $selected; ?> ><?php echo wp_specialchars($label); ?> </option> <?php } ?> </select> </p> </div> <?php } ?> <script language="javascript"> jQuery( document ).ready(function(){ plugin = new Plugin( { delete_rating: '<?php echo esc_attr(__('Are you sure you want to delete the rating for "%s"?', 'polldaddy')); ?> ', delete_poll: '<?php echo esc_attr(__('Are you sure you want to delete "%s"?', 'polldaddy')); ?> ', delete_answer: '<?php echo esc_attr(__('Are you sure you want to delete this answer?', 'polldaddy')); ?> ', delete_answer_title: '<?php echo esc_attr(__('delete this answer', 'polldaddy')); ?> ', standard_styles: '<?php echo esc_attr(__('Standard Styles', 'polldaddy')); ?> ', custom_styles: '<?php echo esc_attr(__('Custom Styles', 'polldaddy')); ?> ' } ); }); </script> <script language="javascript"> current_pos = 0; for( var key in styles_array ) { var name = styles_array[key].name; switch( name ){ case 'Aluminum': styles_array[key].name = '<?php echo esc_attr(__('Aluminum', 'polldaddy')); ?> '; break; case 'Plain White': styles_array[key].name = '<?php echo esc_attr(__('Plain White', 'polldaddy')); ?> '; break; case 'Plain Black': styles_array[key].name = '<?php echo esc_attr(__('Plain Black', 'polldaddy')); ?> '; break; case 'Paper': styles_array[key].name = '<?php echo esc_attr(__('Paper', 'polldaddy')); ?> '; break; case 'Skull Dark': styles_array[key].name = '<?php echo esc_attr(__('Skull Dark', 'polldaddy')); ?> '; break; case 'Skull Light': styles_array[key].name = '<?php echo esc_attr(__('Skull Light', 'polldaddy')); ?> '; break; case 'Micro': styles_array[key].name = '<?php echo esc_attr(__('Micro', 'polldaddy')); ?> '; styles_array[key].n_desc = '<?php echo esc_attr(__('Width 150px, the micro style is useful when space is tight.', 'polldaddy')); ?> '; break; case 'Plastic White': styles_array[key].name = '<?php echo esc_attr(__('Plastic White', 'polldaddy')); ?> '; break; case 'Plastic Grey': styles_array[key].name = '<?php echo esc_attr(__('Plastic Grey', 'polldaddy')); ?> '; break; case 'Plastic Black': styles_array[key].name = '<?php echo esc_attr(__('Plastic Black', 'polldaddy')); ?> '; break; case 'Manga': styles_array[key].name = '<?php echo esc_attr(__('Manga', 'polldaddy')); ?> '; break; case 'Tech Dark': styles_array[key].name = '<?php echo esc_attr(__('Tech Dark', 'polldaddy')); ?> '; break; case 'Tech Grey': styles_array[key].name = '<?php echo esc_attr(__('Tech Grey', 'polldaddy')); ?> '; break; case 'Tech Light': styles_array[key].name = '<?php echo esc_attr(__('Tech Light', 'polldaddy')); ?> '; break; case 'Working Male': styles_array[key].name = '<?php echo esc_attr(__('Working Male', 'polldaddy')); ?> '; break; case 'Working Female': styles_array[key].name = '<?php echo esc_attr(__('Working Female', 'polldaddy')); ?> '; break; case 'Thinking Male': styles_array[key].name = '<?php echo esc_attr(__('Thinking Male', 'polldaddy')); ?> '; break; case 'Thinking Female': styles_array[key].name = '<?php echo esc_attr(__('Thinking Female', 'polldaddy')); ?> '; break; case 'Sunset': styles_array[key].name = '<?php echo esc_attr(__('Sunset', 'polldaddy')); ?> '; break; case 'Music': styles_array[key].name = '<?php echo esc_attr(__('Music', 'polldaddy')); ?> '; break; } } pd_map = { wide : '<?php echo esc_attr(__('Wide', 'polldaddy')); ?> ', medium : '<?php echo esc_attr(__('Medium', 'polldaddy')); ?> ', narrow : '<?php echo esc_attr(__('Narrow', 'polldaddy')); ?> ', style_desc_wide : '<?php echo esc_attr(__('Width: 630px, the wide style is good for blog posts.', 'polldaddy')); ?> ', style_desc_medium : '<?php echo esc_attr(__('Width: 300px, the medium style is good for general use.', 'polldaddy')); ?> ', style_desc_narrow : '<?php echo esc_attr(__('Width 150px, the narrow style is good for sidebars etc.', 'polldaddy')); ?> ', style_desc_micro : '<?php echo esc_attr(__('Width 150px, the micro style is useful when space is tight.', 'polldaddy')); ?> ' } pd_build_styles( current_pos ); <?php if ($style_ID > 0 && $style_ID <= 1000) { ?> pd_pick_style( <?php echo $style_ID; ?> ); <?php } else { ?> pd_change_style( <?php echo $style_ID; ?> ); <?php } ?> </script> </div> </div> </div> </div></div> </form> <br class="clear" /> <?php }
/** * @see polldaddy_poll() * @param int $id PollDaddy Poll ID * @param array $args polldaddy_poll() args * @return array|false PollDaddy Poll or false on failure */ function update_poll($id, $args = null) { if (!($id = (int) $id)) { return false; } if (!($poll = polldaddy_poll($args, $id))) { return false; } // $pos = $this->add_request( __FUNCTION__, $poll ); $pos = $this->add_request('updatepoll', $poll); $this->send_request(); if (!($demand = $this->response_part($pos))) { return $demand; } if (!isset($demand->poll)) { return false; } return $demand->poll; }
function poll_edit_form($poll_id = 1) { $poll_id = (int) $poll_id; $polldaddy = $this->get_client(WP_POLLDADDY__PARTNERGUID, $this->user_code); $polldaddy->reset(); $is_POST = 'post' == strtolower($_SERVER['REQUEST_METHOD']); if ($poll_id) { $poll = $polldaddy->get_poll($poll_id); $this->parse_errors($polldaddy); if (!$this->can_edit($poll)) { $this->errors->add('permission', __('You are not allowed to edit this poll.', 'polldaddy')); } if ($poll_id == 1) { $poll->answers = array(); $poll_id = 0; } } else { $poll = polldaddy_poll(array(), null, false); } $question = $is_POST ? esc_attr(stripslashes($_POST['question'])) : esc_attr($poll->question); $answers = $media = $mediaType = array(); if ($is_POST) { if (isset($_POST['mediaType'])) { $mediaType = $_POST['mediaType']; } if (isset($_POST['media'])) { $mc = $_POST['media']; foreach ($mc as $key => $value) { if ($mediaType[$key] == 1) { $media[$key] = $polldaddy->get_media($value); } } } if (isset($_POST['answer'])) { foreach ($_POST['answer'] as $answer_id => $answer) { $answers[esc_attr($answer_id)] = esc_attr(stripslashes($answer)); } } } elseif (isset($poll->answers->answer)) { foreach ($poll->answers->answer as $answer) { $answers[(int) $answer->_id] = esc_attr($answer->text); if ($answer->mediaType == 1 && !empty($answer->mediaCode)) { $polldaddy->reset(); $media[$answer->_id] = $polldaddy->get_media($answer->mediaCode); $mediaType[$answer->_id] = 1; } elseif ($answer->mediaType == 2) { $mediaType[$answer->_id] = 2; } } if (isset($poll->mediaCode) && isset($poll->mediaType)) { if ($poll->mediaType == 1 && !empty($poll->mediaCode)) { $polldaddy->reset(); $media[999999999] = $polldaddy->get_media($poll->mediaCode); $mediaType[999999999] = 1; } elseif ($poll->mediaType == 2) { $mediaType[999999999] = 2; } } } $this->print_errors(); $delete_media_link = '<a href="#" class="delete-media delete hidden" title="' . esc_attr(__('delete this image')) . '"><img src="' . $this->base_url . 'img/icon-clear-search.png" width="16" height="16" /></a>'; ?> <form enctype="multipart/form-data" name="send-media" action="admin-ajax.php" method="post"> <?php wp_nonce_field('send-media'); ?> <input type="hidden" value="" name="action"> <input type="hidden" value="<?php echo $this->user_code; ?> " name="uc"> <input type="hidden" value="" name="attach-id"> <input type="hidden" value="" name="media-id"> <input type="hidden" value="" name="url"> </form> <form name="add-answer" action="admin-ajax.php" method="post"> <?php wp_nonce_field('add-answer'); ?> <input type="hidden" value="" name="action"> <input type="hidden" value="" name="aa"> <input type="hidden" value="" name="src"> <input type="hidden" value="<?php echo isset($_GET['iframe']) ? '1' : '0'; ?> " name="popup"> </form> <form action="" method="post"> <div id="poststuff"><div id="post-body" class="has-sidebar has-right-sidebar"> <div class="inner-sidebar" id="side-info-column"> <div id="submitdiv" class="postbox"> <h3><?php _e('Save', 'polldaddy'); ?> </h3> <div class="inside"> <div class="minor-publishing"> <ul id="answer-options"> <?php foreach (array('randomiseAnswers' => __('Randomize answer order', 'polldaddy'), 'otherAnswer' => __('Allow other answers', 'polldaddy'), 'multipleChoice' => __('Multiple choice', 'polldaddy'), 'sharing' => __('Sharing', 'polldaddy')) as $option => $label) { if ($is_POST) { $checked = 'yes' === $_POST[$option] ? ' checked="checked"' : ''; } else { $checked = 'yes' === $poll->{$option} ? ' checked="checked"' : ''; } ?> <li> <label for="<?php echo $option; ?> "><input type="checkbox"<?php echo $checked; ?> value="yes" id="<?php echo $option; ?> " name="<?php echo $option; ?> " /> <?php echo esc_html($label); ?> </label> </li> <?php } ?> </ul> <?php if ($is_POST) { $style = 'yes' === $_POST['multipleChoice'] ? 'display:block;' : 'display:none;'; } else { $style = 'yes' === $poll->multipleChoice ? 'display:block;' : 'display:none;'; } ?> <div id="numberChoices" name="numberChoices" style="padding-left:15px;<?php echo $style; ?> "> <p><?php _e('Number of choices', 'polldaddy'); ?> : <select name="choices" id="choices"><option value="0"><?php _e('No Limit', 'polldaddy'); ?> </option> <?php if ($is_POST) { $choices = (int) $_POST['choices']; } else { $choices = (int) $poll->choices; } $a = count($answers) - 1; if ($a > 1) { for ($i = 2; $i <= $a; $i++) { $selected = $i == $choices ? 'selected="selected"' : ''; printf("<option value='%d' %s>%d</option>", $i, $selected, $i); } } ?> </select> </p> </div> </div> <div id="major-publishing-actions"> <p id="publishing-action"> <?php wp_nonce_field($poll_id ? "edit-poll_{$poll_id}" : 'create-poll'); ?> <input type="hidden" name="action" value="<?php echo $poll_id ? 'edit-poll' : 'create-poll'; ?> " /> <input type="hidden" class="polldaddy-poll-id" name="poll" value="<?php echo $poll_id; ?> " /> <input type="submit" class="button-primary" value="<?php echo esc_attr(__('Save Poll', 'polldaddy')); ?> " /> <?php if (isset($_GET['iframe']) && $poll_id) { ?> <div id="delete-action"> <input type="button" class="button polldaddy-send-to-editor" style="margin-top:8px;" value="<?php echo esc_attr(__('Embed in Post', 'polldaddy')); ?> " /> </div> <?php } ?> </p> <br class="clear" /> </div> </div> </div> <div class="postbox"> <h3><?php _e('Results Display', 'polldaddy'); ?> </h3> <div class="inside"> <ul class="poll-options"> <?php foreach (array('show' => __('Show results to voters', 'polldaddy'), 'percent' => __('Only show percentages', 'polldaddy'), 'hide' => __('Hide all results', 'polldaddy')) as $value => $label) { if ($is_POST) { $checked = $value === $_POST['resultsType'] ? ' checked="checked"' : ''; } else { $checked = $value === $poll->resultsType ? ' checked="checked"' : ''; } ?> <li> <label for="resultsType-<?php echo $value; ?> "><input type="radio"<?php echo $checked; ?> value="<?php echo $value; ?> " name="resultsType" id="resultsType-<?php echo $value; ?> " /> <?php echo esc_html($label); ?> </label> </li> <?php } ?> </ul> </div> </div> <div class="postbox"> <h3><?php _e('Repeat Voting', 'polldaddy'); ?> </h3> <div class="inside"> <ul class="poll-options"> <?php foreach (array('off' => __("Don't block repeat voters", 'polldaddy'), 'cookie' => __('Block by cookie (recommended)', 'polldaddy'), 'cookieip' => __('Block by cookie and by IP address', 'polldaddy')) as $value => $label) { if ($is_POST) { $checked = $value === $_POST['blockRepeatVotersType'] ? ' checked="checked"' : ''; } else { $checked = $value === $poll->blockRepeatVotersType ? ' checked="checked"' : ''; } ?> <li> <label for="blockRepeatVotersType-<?php echo $value; ?> "><input class="block-repeat" type="radio"<?php echo $checked; ?> value="<?php echo $value; ?> " name="blockRepeatVotersType" id="blockRepeatVotersType-<?php echo $value; ?> " /> <?php echo esc_html($label); ?> </label> </li> <?php } ?> </ul> <?php if ($poll->blockExpiration == 0 || $poll->blockExpiration > 604800) { $poll->blockExpiration = 604800; } ?> <span style="margin:6px 6px 8px;<?php echo $poll->blockRepeatVotersType == 'off' ? 'display:none;' : ''; ?> " id="cookieip_expiration_label"><label><?php _e('Expires: ', 'polldaddy'); ?> </label></span> <select id="cookieip_expiration" name="cookieip_expiration" style="width: auto;<?php echo $poll->blockRepeatVotersType == 'off' ? 'display:none;' : ''; ?> "> <option value="3600" <?php echo (int) $poll->blockExpiration == 3600 ? 'selected' : ''; ?> ><?php printf(__('%d hour', 'polldaddy'), 1); ?> </option> <option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected' : ''; ?> ><?php printf(__('%d hours', 'polldaddy'), 3); ?> </option> <option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected' : ''; ?> ><?php printf(__('%d hours', 'polldaddy'), 6); ?> </option> <option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected' : ''; ?> ><?php printf(__('%d hours', 'polldaddy'), 12); ?> </option> <option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected' : ''; ?> ><?php printf(__('%d day', 'polldaddy'), 1); ?> </option> <option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected' : ''; ?> ><?php printf(__('%d week', 'polldaddy'), 1); ?> </option> </select> <p><?php _e('Note: Blocking by cookie and IP address can be problematic for some voters.', 'polldaddy'); ?> </p> </div> </div> <div class="postbox"> <h3><?php _e('Comments', 'polldaddy'); ?> </h3> <div class="inside"> <ul class="poll-options"> <?php foreach (array('allow' => __("Allow comments", 'polldaddy'), 'moderate' => __('Moderate first', 'polldaddy'), 'off' => __('No comments', 'polldaddy')) as $value => $label) { if ($is_POST) { $checked = $value === $_POST['comments'] ? ' checked="checked"' : ''; } else { $checked = $value === $poll->comments->___content ? ' checked="checked"' : ''; } ?> <li> <label for="comments-<?php echo $value; ?> "><input type="radio"<?php echo $checked; ?> value="<?php echo $value; ?> " name="comments" id="comments-<?php echo $value; ?> " /> <?php echo esc_html($label); ?> </label> </li> <?php } ?> </ul> </div> </div> </div> <div id="post-body-content" class="has-sidebar-content"> <div id="titlediv" style="margin-top:0px;"> <div id="titlewrap"> <table class="question"> <tr> <td class="question-input"> <input type="text" autocomplete="off" id="title" placeholder="<?php _e('Enter Question Here', 'polldaddy'); ?> " value="<?php echo $question; ?> " tabindex="1" size="30" name="question" /> </td> <td class="answer-media-icons" <?php echo isset($_GET['iframe']) ? 'style="width: 55px !important;"' : ''; ?> > <ul class="answer-media" <?php echo isset($_GET['iframe']) ? 'style="min-width: 30px;"' : ''; ?> > <?php if (isset($mediaType[999999999]) && $mediaType[999999999] == 2) { ?> <li class="media-preview image-added" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="<?php echo $this->base_url; ?> img/icon-report-ip-analysis.png" alt="Video Embed"><?php echo $delete_media_link; ?> </li> <?php } else { $url = ''; if (isset($media[999999999])) { $url = urldecode($media[999999999]->img_small); if (is_ssl()) { $url = preg_replace('/http\\:/', 'https:', $url); } } ?> <li class="media-preview <?php echo !empty($url) ? 'image-added' : ''; ?> " style="width: 20px; height: 16px; padding-left: 5px;"><?php echo $url; echo $delete_media_link; ?> </li> <?php } if (!isset($_GET['iframe'])) { ?> <li><a title="<?php echo esc_attr(__('Add an Image', 'polldaddy')); ?> " class="thickbox media image" id="add_poll_image999999999" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr(__('Add an Image', 'polldaddy')); ?> " src="images/media-button-image.gif"></a></li> <li><a title="<?php echo esc_attr(__('Add Audio', 'polldaddy')); ?> " class="thickbox media video" id="add_poll_video999999999" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr(__('Add Audio', 'polldaddy')); ?> " src="images/media-button-video.gif"></a></li> <li><a title="<?php echo esc_attr(__('Add Video', 'polldaddy')); ?> " class="thickbox media audio" id="add_poll_audio999999999" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr(__('Add Video', 'polldaddy')); ?> " src="images/media-button-music.gif"></a></li> <?php } ?> </ul> <input type="hidden" value="<?php echo isset($media[999999999]) ? $media[999999999]->_id : ''; ?> " id="hMC999999999" name="media[999999999]"> <input type="hidden" value="<?php echo isset($mediaType[999999999]) ? $mediaType[999999999] : ''; ?> " id="hMT999999999" name="mediaType[999999999]"> </td> </tr> </table> <?php if (isset($poll->_id) && !isset($_GET['iframe'])) { ?> <div class="inside"> <div id="edit-slug-box" style="margin-bottom:30px;"> <strong><?php _e('WordPress Shortcode:', 'polldaddy'); ?> </strong> <input type="text" style="color:#999;" value="[polldaddy poll=<?php echo $poll->_id; ?> ]" id="shortcode-field" readonly="readonly" /> <span><a href="post-new.php?content=[polldaddy poll=<?php echo $poll->_id; ?> ]" class="button"><?php _e('Embed Poll in New Post'); ?> </a></span> </div> </div> <?php } ?> </div> </div> <div id="answersdiv" class="postbox"> <h3><?php _e('Answers', 'polldaddy'); ?> </h3> <div id="answerswrap" class="inside"> <ul id="answers"> <?php $a = 0; foreach ($answers as $answer_id => $answer) { $a++; $delete_link = esc_url(wp_nonce_url(add_query_arg(array('action' => 'delete-answer', 'poll' => $poll_id, 'answer' => $answer_id, 'message' => false)), "delete-answer_{$answer_id}")); ?> <li> <table class="answer"> <tr> <th> <span class="handle" title="<?php echo esc_attr(__('click and drag to reorder')); ?> "><img src="<?php echo $this->base_url; ?> img/icon-reorder.png" alt="click and drag to reorder" width="6" height="9" /></span> </th> <td class="answer-input"> <input type="text" autocomplete="off" placeholder="<?php echo esc_attr(__('Enter an answer here', 'polldaddy')); ?> " id="answer-<?php echo $answer_id; ?> " value="<?php echo $answer; ?> " tabindex="2" size="30" name="answer[<?php echo $answer_id; ?> ]" /> </td> <td class="answer-media-icons" <?php echo isset($_GET['iframe']) ? 'style="width: 55px !important;"' : ''; ?> > <ul class="answer-media" <?php echo isset($_GET['iframe']) ? 'style="min-width: 30px;"' : ''; ?> > <?php if (isset($mediaType[$answer_id]) && $mediaType[$answer_id] == 2) { ?> <li class="media-preview image-added" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="<?php echo $this->base_url; ?> img/icon-report-ip-analysis.png" alt="Video Embed"><?php echo $delete_media_link; ?> </li> <?php } else { $url = ''; if (isset($media[$answer_id])) { $url = urldecode($media[$answer_id]->img_small); if (is_ssl()) { $url = preg_replace('/http\\:/', 'https:', $url); } } ?> <li class="media-preview <?php echo !empty($url) ? 'image-added' : ''; ?> " style="width: 20px; height: 16px; padding-left: 5px;"><?php echo $url; echo $delete_media_link; ?> </li> <?php } if (!isset($_GET['iframe'])) { ?> <li><a title="<?php echo esc_attr(__('Add an Image', 'polldaddy')); ?> " class="thickbox media image" id="add_poll_image<?php echo $answer_id; ?> " href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr(__('Add an Image', 'polldaddy')); ?> " src="images/media-button-image.gif"></a></li> <li><a title="<?php echo esc_attr(__('Add Audio', 'polldaddy')); ?> " class="thickbox media video" id="add_poll_video<?php echo $answer_id; ?> " href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr(__('Add Audio', 'polldaddy')); ?> " src="images/media-button-video.gif"></a></li> <li><a title="<?php echo esc_attr(__('Add Video', 'polldaddy')); ?> " class="thickbox media audio" id="add_poll_audio<?php echo $answer_id; ?> " href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr(__('Add Video', 'polldaddy')); ?> " src="images/media-button-music.gif"></a></li> <?php } ?> <li><a href="<?php echo $delete_link; ?> " class="delete-answer delete" title="<?php echo esc_attr(__('delete this answer')); ?> "><img src="<?php echo $this->base_url; ?> img/icon-clear-search.png" width="16" height="16" /></a></li> </ul> <input type="hidden" value="<?php echo isset($media[$answer_id]) ? $media[$answer_id]->_id : ''; ?> " id="hMC<?php echo $answer_id; ?> " name="media[<?php echo $answer_id; ?> ]"> <input type="hidden" value="<?php echo isset($mediaType[$answer_id]) ? $mediaType[$answer_id] : ''; ?> " id="hMT<?php echo $answer_id; ?> " name="mediaType[<?php echo $answer_id; ?> ]"> </td> </tr> </table> </li> <?php } while (3 - $a > 0) { $a++; ?> <li> <table class="answer"> <tr> <th> <span class="handle" title="<?php echo esc_attr(__('click and drag to reorder')); ?> "><img src="<?php echo $this->base_url; ?> img/icon-reorder.png" alt="click and drag to reorder" width="6" height="9" /></span> </th> <td class="answer-input"> <input type="text" autocomplete="off" placeholder="<?php echo esc_attr(__('Enter an answer here', 'polldaddy')); ?> " value="" tabindex="2" size="30" name="answer[new<?php echo $a; ?> ]" /> </td> <td class="answer-media-icons" <?php echo isset($_GET['iframe']) ? 'style="width:55px !important;"' : ''; ?> > <ul class="answer-media" <?php echo isset($_GET['iframe']) ? 'style="min-width: 30px;"' : ''; ?> > <li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"></li> <?php if (!isset($_GET['iframe'])) { ?> <li><a title="<?php echo esc_attr(__('Add an Image', 'polldaddy')); ?> " class="thickbox media image" id="add_poll_image<?php echo $a; ?> " href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr(__('Add an Image', 'polldaddy')); ?> " src="images/media-button-image.gif"></a></a></li> <li><a title="<?php echo esc_attr(__('Add Audio', 'polldaddy')); ?> " class="thickbox media video" id="add_poll_video<?php echo $a; ?> " href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr(__('Add Audio', 'polldaddy')); ?> " src="images/media-button-video.gif"></a></a></li> <li><a title="<?php echo esc_attr(__('Add Video', 'polldaddy')); ?> " class="thickbox media audio" id="add_poll_audio<?php echo $a; ?> " href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr(__('Add Video', 'polldaddy')); ?> " src="images/media-button-music.gif"></a></li> <?php } ?> <li><a href="#" class="delete-answer delete" title="<?php echo esc_attr(__('delete this answer')); ?> "><img src="<?php echo $this->base_url; ?> img/icon-clear-search.png" width="16" height="16" /></a></li> </ul> <input type="hidden" value="" id="hMC<?php echo $a; ?> " name="media[<?php echo $a; ?> ]"> <input type="hidden" value="" id="hMT<?php echo $a; ?> " name="mediaType[<?php echo $a; ?> ]"> </td> </tr> </table> </li> <?php } ?> </ul> <p id="add-answer-holder" class="<?php echo $this->base_url; ?> "> <button class="button"><?php echo esc_html(__('Add New Answer', 'polldaddy')); ?> </button> </p> </div> </div> <div class="hidden-links"><div class="delete-media-link"><?php echo $delete_media_link; ?> </div></div> <div id="design" class="postbox"> <?php $style_ID = (int) ($is_POST ? $_POST['styleID'] : $poll->styleID); $iframe_view = false; if (isset($_GET['iframe'])) { $iframe_view = true; } $options = array(101 => __('Aluminum Narrow', 'polldaddy'), 102 => __('Aluminum Medium', 'polldaddy'), 103 => __('Aluminum Wide', 'polldaddy'), 104 => __('Plain White Narrow', 'polldaddy'), 105 => __('Plain White Medium', 'polldaddy'), 106 => __('Plain White Wide', 'polldaddy'), 107 => __('Plain Black Narrow', 'polldaddy'), 108 => __('Plain Black Medium', 'polldaddy'), 109 => __('Plain Black Wide', 'polldaddy'), 110 => __('Paper Narrow', 'polldaddy'), 111 => __('Paper Medium', 'polldaddy'), 112 => __('Paper Wide', 'polldaddy'), 113 => __('Skull Dark Narrow', 'polldaddy'), 114 => __('Skull Dark Medium', 'polldaddy'), 115 => __('Skull Dark Wide', 'polldaddy'), 116 => __('Skull Light Narrow', 'polldaddy'), 117 => __('Skull Light Medium', 'polldaddy'), 118 => __('Skull Light Wide', 'polldaddy'), 157 => __('Micro', 'polldaddy'), 119 => __('Plastic White Narrow', 'polldaddy'), 120 => __('Plastic White Medium', 'polldaddy'), 121 => __('Plastic White Wide', 'polldaddy'), 122 => __('Plastic Grey Narrow', 'polldaddy'), 123 => __('Plastic Grey Medium', 'polldaddy'), 124 => __('Plastic Grey Wide', 'polldaddy'), 125 => __('Plastic Black Narrow', 'polldaddy'), 126 => __('Plastic Black Medium', 'polldaddy'), 127 => __('Plastic Black Wide', 'polldaddy'), 128 => __('Manga Narrow', 'polldaddy'), 129 => __('Manga Medium', 'polldaddy'), 130 => __('Manga Wide', 'polldaddy'), 131 => __('Tech Dark Narrow', 'polldaddy'), 132 => __('Tech Dark Medium', 'polldaddy'), 133 => __('Tech Dark Wide', 'polldaddy'), 134 => __('Tech Grey Narrow', 'polldaddy'), 135 => __('Tech Grey Medium', 'polldaddy'), 136 => __('Tech Grey Wide', 'polldaddy'), 137 => __('Tech Light Narrow', 'polldaddy'), 138 => __('Tech Light Medium', 'polldaddy'), 139 => __('Tech Light Wide', 'polldaddy'), 140 => __('Working Male Narrow', 'polldaddy'), 141 => __('Working Male Medium', 'polldaddy'), 142 => __('Working Male Wide', 'polldaddy'), 143 => __('Working Female Narrow', 'polldaddy'), 144 => __('Working Female Medium', 'polldaddy'), 145 => __('Working Female Wide', 'polldaddy'), 146 => __('Thinking Male Narrow', 'polldaddy'), 147 => __('Thinking Male Medium', 'polldaddy'), 148 => __('Thinking Male Wide', 'polldaddy'), 149 => __('Thinking Female Narrow', 'polldaddy'), 150 => __('Thinking Female Medium', 'polldaddy'), 151 => __('Thinking Female Wide', 'polldaddy'), 152 => __('Sunset Narrow', 'polldaddy'), 153 => __('Sunset Medium', 'polldaddy'), 154 => __('Sunset Wide', 'polldaddy'), 155 => __('Music Medium', 'polldaddy'), 156 => __('Music Wide', 'polldaddy')); $polldaddy->reset(); $styles = $polldaddy->get_styles(); $show_custom = false; if (!empty($styles) && !empty($styles->style) && count($styles->style) > 0) { foreach ((array) $styles->style as $style) { $options[(int) $style->_id] = $style->title; } $show_custom = true; } if ($style_ID > 18) { $standard_style_ID = 0; $custom_style_ID = $style_ID; } else { $standard_style_ID = $style_ID; $custom_style_ID = 0; } ?> <h3><?php _e('Poll Style', 'polldaddy'); ?> </h3> <input type="hidden" name="styleID" id="styleID" value="<?php echo $style_ID; ?> "> <div class="inside"> <ul class="pd-tabs"> <li class="selected" id="pd-styles"><a href="#"><?php _e('Polldaddy Styles', 'polldaddy'); ?> </a><input type="checkbox" style="display:none;" id="regular"/></li> <?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?> <li id="pd-custom-styles" <?php echo $hide; ?> ><a href="#"><?php _e('Custom Styles', 'polldaddy'); ?> </a><input type="checkbox" style="display:none;" id="custom"/></li> </ul> <div class="pd-tab-panel show" id="pd-styles-panel"> <?php if ($iframe_view) { ?> <div id="design_standard" style="padding:0px;padding-top:10px;"> <div class="hide-if-no-js"> <table class="pollStyle"> <thead> <tr> <th> <div style="display:none;"> <input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/> </div> </th> </tr> </thead> <tr> <td class="selector" style="width:120px;"> <table class="st_selector"> <tr> <td class="dir_left" style="padding:0px;width:30px;"> <a href="javascript:pd_move('prev');" style="display: block;font-size: 3.2em;text-decoration: none;">«</a> </td> <td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td> <td class="dir_right" style="padding:0px;width:30px;"> <a href="javascript:pd_move('next');" style="display: block;padding-left:20px;font-size: 3.2em;text-decoration: none;">»</a> </td> </tr> <tr> <td></td> <td class="counter"> <div id="st_number"></div> </td> <td></td> </tr> <tr> <td></td> <td class="title"> <div id="st_name"></div> </td> <td></td> </tr> <tr> <td></td> <td> <div id="st_sizes"></div> </td> <td></td> </tr> <tr> <td colspan="3"> <div style="width:230px;" id="st_description"></div> </td> </tr> </table> </td> </tr> </table> </div> <p class="empty-if-js" id="no-js-styleID"> <select id="styleID" name="styleID"> <?php foreach ($options as $styleID => $label) { $selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?> <option value="<?php echo (int) $styleID; ?> "<?php echo $selected; ?> ><?php echo esc_html($label); ?> </option> <?php } ?> </select> </p> </div> <?php } else { ?> <div class="design_standard"> <div class="hide-if-no-js"> <table class="pollStyle"> <thead> <tr style="display:none;"> <th class="cb"> <input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/> <label for="skin" onclick="javascript:pd_build_styles( 0 );"><?php _e('Polldaddy Style', 'polldaddy'); ?> </label> <?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?> <input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style(_$('customSelect').value);" <?php echo $disabled; ?> /> <label onclick="javascript:pd_change_style(_$('customSelect').value);"><?php _e('Custom Style', 'polldaddy'); ?> </label> <th> </tr> </thead> <tbody> <tr> <td style="text-align:center"> <table class="st_selector" style="margin:20px auto;"> <tr> <td class="dir_left"> <a href="javascript:pd_move('prev');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">«</a> </td> <td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td> <td class="dir_right"> <a href="javascript:pd_move('next');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">»</a> </td> </tr> <tr> <td></td> <td class="counter"> <div id="st_number"></div> </td> <td></td> </tr> <tr> <td></td> <td class="title"> <div id="st_name"></div> </td> <td></td> </tr> <tr> <td></td> <td> <div id="st_sizes"></div> </td> <td></td> </tr> <tr> <td colspan="3"> <div id="st_description"></div> </td> </tr> </table> </td> </tr> </tbody> </table> </div> <p class="empty-if-js" id="no-js-styleID"> <select id="styleID" name="styleID"> <?php foreach ($options as $styleID => $label) { $selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?> <option value="<?php echo (int) $styleID; ?> "<?php echo $selected; ?> ><?php echo esc_html($label); ?> </option> <?php } ?> </select> </p> </div> <?php } ?> </div> <div class="pd-tab-panel" id="pd-custom-styles-panel"> <div style="padding:20px;"> <?php if ($show_custom) { ?> <p><a href="<?php echo esc_url(add_query_arg(array('action' => 'list-styles', 'poll' => false, 'style' => false, 'message' => false, 'preload' => false))); ?> " class="add-new-h2">All Styles</a></p> <select id="customSelect" name="customSelect" onchange="javascript:pd_change_style(this.value);"> <?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?> <option value="x"<?php echo $selected; ?> ><?php _e('Please choose a custom style…', 'polldaddy'); ?> </option> <?php foreach ((array) $styles->style as $style) { $selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?> <option value="<?php echo (int) $style->_id; ?> "<?php echo $selected; ?> ><?php echo esc_html($style->title); ?> </option> <?php } ?> </select> <div id="styleIDErr" class="formErr" style="display:none;"><?php _e('Please choose a style.', 'polldaddy'); ?> </div> <?php } else { ?> <p><?php _e('You currently have no custom styles created.', 'polldaddy'); ?> <a href="/wp-admin/edit.php?page=polls&action=create-style" class="add-new-h2"><?php _e('New Style', 'polldaddy'); ?> </a></p> <p><?php printf(__('Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.', 'polldaddy'), 'http://support.polldaddy.com/custom-poll-styles/'); ?> </p> <?php } ?> </div> </div> <script language="javascript"> jQuery( document ).ready(function(){ plugin = new Plugin( { delete_rating: '<?php echo esc_attr(__('Are you sure you want to delete the rating for "%s"?', 'polldaddy')); ?> ', delete_poll: '<?php echo esc_attr(__('Are you sure you want to delete "%s"?', 'polldaddy')); ?> ', delete_answer: '<?php echo esc_attr(__('Are you sure you want to delete this answer?', 'polldaddy')); ?> ', new_answer_test: '<?php echo esc_attr(__('Enter an answer here', 'polldaddy')); ?> ', delete_answer_title: '<?php echo esc_attr(__('delete this answer', 'polldaddy')); ?> ', reorder_answer_title: '<?php echo esc_attr(__('click and drag to reorder', 'polldaddy')); ?> ', add_image_title: '<?php echo esc_attr(__('Add an Image', 'polldaddy')); ?> ', add_audio_title: '<?php echo esc_attr(__('Add Audio', 'polldaddy')); ?> ', add_video_title: '<?php echo esc_attr(__('Add Video', 'polldaddy')); ?> ', standard_styles: '<?php echo esc_attr(__('Standard Styles', 'polldaddy')); ?> ', custom_styles: '<?php echo esc_attr(__('Custom Styles', 'polldaddy')); ?> ', base_url: '<?php echo esc_attr($this->base_url); ?> ' } ); }); </script> <script language="javascript"> current_pos = 0; for( var key in styles_array ) { var name = styles_array[key].name; switch( name ){ case 'Aluminum': styles_array[key].name = '<?php echo esc_attr(__('Aluminum', 'polldaddy')); ?> '; break; case 'Plain White': styles_array[key].name = '<?php echo esc_attr(__('Plain White', 'polldaddy')); ?> '; break; case 'Plain Black': styles_array[key].name = '<?php echo esc_attr(__('Plain Black', 'polldaddy')); ?> '; break; case 'Paper': styles_array[key].name = '<?php echo esc_attr(__('Paper', 'polldaddy')); ?> '; break; case 'Skull Dark': styles_array[key].name = '<?php echo esc_attr(__('Skull Dark', 'polldaddy')); ?> '; break; case 'Skull Light': styles_array[key].name = '<?php echo esc_attr(__('Skull Light', 'polldaddy')); ?> '; break; case 'Micro': styles_array[key].name = '<?php echo esc_attr(__('Micro', 'polldaddy')); ?> '; styles_array[key].n_desc = '<?php echo esc_attr(__('Width 150px, the micro style is useful when space is tight.', 'polldaddy')); ?> '; break; case 'Plastic White': styles_array[key].name = '<?php echo esc_attr(__('Plastic White', 'polldaddy')); ?> '; break; case 'Plastic Grey': styles_array[key].name = '<?php echo esc_attr(__('Plastic Grey', 'polldaddy')); ?> '; break; case 'Plastic Black': styles_array[key].name = '<?php echo esc_attr(__('Plastic Black', 'polldaddy')); ?> '; break; case 'Manga': styles_array[key].name = '<?php echo esc_attr(__('Manga', 'polldaddy')); ?> '; break; case 'Tech Dark': styles_array[key].name = '<?php echo esc_attr(__('Tech Dark', 'polldaddy')); ?> '; break; case 'Tech Grey': styles_array[key].name = '<?php echo esc_attr(__('Tech Grey', 'polldaddy')); ?> '; break; case 'Tech Light': styles_array[key].name = '<?php echo esc_attr(__('Tech Light', 'polldaddy')); ?> '; break; case 'Working Male': styles_array[key].name = '<?php echo esc_attr(__('Working Male', 'polldaddy')); ?> '; break; case 'Working Female': styles_array[key].name = '<?php echo esc_attr(__('Working Female', 'polldaddy')); ?> '; break; case 'Thinking Male': styles_array[key].name = '<?php echo esc_attr(__('Thinking Male', 'polldaddy')); ?> '; break; case 'Thinking Female': styles_array[key].name = '<?php echo esc_attr(__('Thinking Female', 'polldaddy')); ?> '; break; case 'Sunset': styles_array[key].name = '<?php echo esc_attr(__('Sunset', 'polldaddy')); ?> '; break; case 'Music': styles_array[key].name = '<?php echo esc_attr(__('Music', 'polldaddy')); ?> '; break; } } pd_map = { wide : '<?php echo esc_attr(__('Wide', 'polldaddy')); ?> ', medium : '<?php echo esc_attr(__('Medium', 'polldaddy')); ?> ', narrow : '<?php echo esc_attr(__('Narrow', 'polldaddy')); ?> ', style_desc_wide : '<?php echo esc_attr(__('Width: 630px, the wide style is good for blog posts.', 'polldaddy')); ?> ', style_desc_medium : '<?php echo esc_attr(__('Width: 300px, the medium style is good for general use.', 'polldaddy')); ?> ', style_desc_narrow : '<?php echo esc_attr(__('Width 150px, the narrow style is good for sidebars etc.', 'polldaddy')); ?> ', style_desc_micro : '<?php echo esc_attr(__('Width 150px, the micro style is useful when space is tight.', 'polldaddy')); ?> ', image_path : '<?php echo plugins_url('img', __FILE__); ?> ' } pd_build_styles( current_pos ); <?php if ($style_ID > 0 && $style_ID <= 1000) { ?> pd_pick_style( <?php echo $style_ID; ?> ); <?php } else { ?> pd_change_style( <?php echo $style_ID; ?> ); <?php } ?> </script> </div> </div> </div> </div></div> </form> <br class="clear" /> <?php }