function prettyphoto_get_attachment_link($html, $id, $size, $permalink) { global $post; $pid = $post->ID; $hook = prettyphoto_get_option('hook'); $selector = prettyphoto_get_option('ppselector'); if (!$permalink) { $html = preg_match('/' . $hook . '="/', $html) ? str_replace($hook . '="', $hook . '="' . $selector . '[gallery-' . $pid . '] ', $html) : str_replace('<a ', '<a ' . $hook . '="' . $selector . '[gallery-' . $pid . ']" ', $html); } return $html; }
function prettyphoto_create_setting($args = array(), $before = '<div class="row">', $after = '</div>') { extract($args); $settings_field = isset($groupid) ? prettyphoto_get_option($groupid) : prettyphoto_get_option($id); $field_value = isset($groupid) ? $settings_field[$id] : $settings_field; $prefix = 'prettyphoto_settings'; $setting_id = isset($groupid) ? $prefix . '[' . $groupid . '][' . $id . ']' : $prefix . '[' . $id . ']'; $html = $before . "\n"; switch ($type) { case 'text': if (isset($label)) { $html .= "\t" . '<label for="' . $id . '">' . $label . '</label>' . "\n"; } $html .= "\t" . '<input type="text" id="' . $id . '" name="' . $setting_id . '" '; if (isset($class)) { $html .= 'class="' . $class . '" '; } $html .= 'value="' . esc_attr($field_value) . '" />' . "\n"; if (isset($desc)) { $html .= '<span class="description">' . esc_attr($desc) . '</span>' . "\n"; } break; case 'checkbox': if (isset($label)) { $html .= "\t" . '<label for="' . $id . '">' . $label . '</label>' . "\n"; } $html .= "\t" . '<input type="checkbox" id="' . $id . '" name="' . $setting_id . '" value="' . $value . '"' . checked($value, $field_value, false) . ' />' . "\n"; if (isset($desc)) { $html .= '<span class="description">' . esc_attr($desc) . '</span>' . "\n"; } break; case 'select': if (isset($label)) { $html .= "\t" . '<label for="' . $id . '">' . $label . '</label>' . "\n"; } $html .= "\t" . '<select id="' . $id . '" name="' . $setting_id . '">' . "\n"; foreach ($options as $option => $label) { $html .= "\t\t" . '<option value="' . esc_attr($option) . '"' . selected($option, $field_value, false) . '>'; $html .= esc_attr($label); $html .= '</option>' . "\n"; } $html .= "\t" . '</select>' . "\n"; if (isset($desc)) { $html .= '<span class="description">' . esc_attr($desc) . '</span>' . "\n"; } break; case 'textarea': if (isset($label)) { $html .= "\t" . '<label for="' . $id . '">' . $label . '</label>' . "\n"; } $html .= "\t" . '<textarea id="' . $id . '" name="' . $setting_id . '" '; if (isset($class)) { $html .= 'class="' . $class . '" '; } if (isset($rows)) { $html .= 'rows="' . $rows . '"'; } if (isset($cols)) { $html .= 'cols="' . $cols . '"'; } $html .= '>' . esc_attr($field_value) . '</textarea>' . "\n"; if (isset($desc)) { $html .= '<span class="description">' . esc_attr($desc) . '</span>' . "\n"; } break; default: break; } $html .= $after . "\n"; return $html; }