本文整理汇总了PHP中nggGallery::get_option方法的典型用法代码示例。如果您正苦于以下问题:PHP nggGallery::get_option方法的具体用法?PHP nggGallery::get_option怎么用?PHP nggGallery::get_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nggGallery
的用法示例。
在下文中一共展示了nggGallery::get_option方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instantiate
public function instantiate()
{
$this->options = nggGallery::get_option('ngg_options');
$this->overwriteNggConf();
add_filter('ngg_show_gallery_content', array(&$this, "ngg_show_gallery_content"));
add_filter('ngg_show_imagebrowser_content', array(&$this, "ngg_show_imagebrowser_content"));
add_filter('ngg_show_album_content', array(&$this, "ngg_show_album_content"));
add_filter('ngg_show_slideshow_content', array(&$this, "ngg_show_slideshow_content"), 10, 4);
add_filter('ngg_show_slideshow_widget_content', array(&$this, "ngg_show_slideshow_widget_content"), 10, 4);
add_filter('ngg_slideshow_size', array(&$this, "ngg_slideshow_size"));
add_filter('wptouch_user_agents', array(&$this, "wptouch_user_agents"));
}
示例2: get_gallery_mrss
/**
* Get the XML <rss> node corresponding to a gallery
*
* @param $gallery (object) The gallery to include in RSS
* @param $prev_gallery (object) The previous gallery to link in RSS (null if none)
* @param $next_gallery (object) The next gallery to link in RSS (null if none)
*/
function get_gallery_mrss($gallery, $prev_gallery = null, $next_gallery = null)
{
$ngg_options = nggGallery::get_option('ngg_options');
//Set sort order value, if not used (upgrade issue)
$ngg_options['galSort'] = $ngg_options['galSort'] ? $ngg_options['galSort'] : 'pid';
$ngg_options['galSortDir'] = $ngg_options['galSortDir'] == 'DESC' ? 'DESC' : 'ASC';
$title = stripslashes(M_I18N::translate($gallery->title));
$description = stripslashes(M_I18N::translate($gallery->galdesc));
$link = nggMediaRss::get_permalink($gallery->pageid);
$prev_link = $prev_gallery != null ? nggMediaRss::get_gallery_mrss_url($prev_gallery->gid, true) : '';
$next_link = $next_gallery != null ? nggMediaRss::get_gallery_mrss_url($next_gallery->gid, true) : '';
$images = nggdb::get_gallery($gallery->gid, $ngg_options['galSort'], $ngg_options['galSortDir']);
return nggMediaRss::get_mrss_root_node($title, $description, $link, $prev_link, $next_link, $images);
}
示例3: widget
function widget($args, $instance)
{
extract($args);
$ngg_options = nggGallery::get_option('ngg_options');
$title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title'], $instance, $this->id_base);
$show_global_mrss = $instance['show_global_mrss'];
$show_icon = $instance['show_icon'];
$mrss_text = stripslashes($instance['mrss_text']);
$mrss_title = strip_tags(stripslashes($instance['mrss_title']));
echo $before_widget;
echo $before_title . $title . $after_title;
echo "<ul class='ngg-media-rss-widget'>\n";
if ($show_global_mrss) {
echo " <li>";
echo $this->get_mrss_link(nggMediaRss::get_mrss_url(), $show_icon, stripslashes($mrss_title), stripslashes($mrss_text), $ngg_options['usePicLens']);
echo "</li>\n";
}
echo "</ul>\n";
echo $after_widget;
}
示例4: nggShowRelatedImages
/**
* nggShowRelatedImages() - return related images based on category or tags
*
* @access public
* @param string $type could be 'tags' or 'category'
* @param integer $maxImages of images
* @return the content
*/
function nggShowRelatedImages($type = '', $maxImages = 0)
{
$ngg_options = nggGallery::get_option('ngg_options');
if ($type == '') {
$type = $ngg_options['appendType'];
$maxImages = $ngg_options['maxImages'];
}
$sluglist = array();
switch ($type) {
case 'tags':
if (function_exists('get_the_tags')) {
$taglist = get_the_tags();
if (is_array($taglist)) {
foreach ($taglist as $tag) {
$sluglist[] = $tag->slug;
}
}
}
break;
case 'category':
$catlist = get_the_category();
if (is_array($catlist)) {
foreach ($catlist as $cat) {
$sluglist[] = $cat->category_nicename;
}
}
break;
}
$sluglist = implode(',', $sluglist);
$out = nggShowRelatedGallery($sluglist, $maxImages);
return $out;
}
示例5: convert_shortcode
/**
* NextGEN_shortcodes::convert_shortcode()
* convert old shortcodes to the new WordPress core style
* [gallery=1] ->> [nggallery id=1]
*
* @param string $content Content to search for shortcodes
* @return string Content with new shortcodes.
*/
function convert_shortcode($content)
{
$ngg_options = nggGallery::get_option('ngg_options');
if (stristr($content, '[singlepic')) {
$search = "@\\[singlepic=(\\d+)(|,\\d+|,)(|,\\d+|,)(|,watermark|,web20|,)(|,right|,center|,left|,)\\]@i";
if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
// remove the comma
$match[2] = ltrim($match[2], ',');
$match[3] = ltrim($match[3], ',');
$match[4] = ltrim($match[4], ',');
$match[5] = ltrim($match[5], ',');
$replace = "[singlepic id=\"{$match[1]}\" w=\"{$match[2]}\" h=\"{$match[3]}\" mode=\"{$match[4]}\" float=\"{$match[5]}\" ]";
$content = str_replace($match[0], $replace, $content);
}
}
}
if (stristr($content, '[album')) {
$search = "@(?:<p>)*\\s*\\[album\\s*=\\s*(\\w+|^\\+)(|,extend|,compact)\\]\\s*(?:</p>)*@i";
if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
// remove the comma
$match[2] = ltrim($match[2], ',');
$replace = "[album id=\"{$match[1]}\" template=\"{$match[2]}\"]";
$content = str_replace($match[0], $replace, $content);
}
}
}
if (stristr($content, '[gallery')) {
$search = "@(?:<p>)*\\s*\\[gallery\\s*=\\s*(\\w+|^\\+)\\]\\s*(?:</p>)*@i";
if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$replace = "[nggallery id=\"{$match[1]}\"]";
$content = str_replace($match[0], $replace, $content);
}
}
}
if (stristr($content, '[imagebrowser')) {
$search = "@(?:<p>)*\\s*\\[imagebrowser\\s*=\\s*(\\w+|^\\+)\\]\\s*(?:</p>)*@i";
if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$replace = "[imagebrowser id=\"{$match[1]}\"]";
$content = str_replace($match[0], $replace, $content);
}
}
}
if (stristr($content, '[slideshow')) {
$search = "@(?:<p>)*\\s*\\[slideshow\\s*=\\s*(\\w+|^\\+)(|,(\\d+)|,)(|,(\\d+))\\]\\s*(?:</p>)*@i";
if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
// remove the comma
$match[3] = ltrim($match[3], ',');
$match[5] = ltrim($match[5], ',');
$replace = "[slideshow id=\"{$match[1]}\" w=\"{$match[3]}\" h=\"{$match[5]}\"]";
$content = str_replace($match[0], $replace, $content);
}
}
}
if (stristr($content, '[tags')) {
$search = "@(?:<p>)*\\s*\\[tags\\s*=\\s*(.*?)\\s*\\]\\s*(?:</p>)*@i";
if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$replace = "[nggtags gallery=\"{$match[1]}\"]";
$content = str_replace($match[0], $replace, $content);
}
}
}
if (stristr($content, '[albumtags')) {
$search = "@(?:<p>)*\\s*\\[albumtags\\s*=\\s*(.*?)\\s*\\]\\s*(?:</p>)*@i";
if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$replace = "[nggtags album=\"{$match[1]}\"]";
$content = str_replace($match[0], $replace, $content);
}
}
}
return $content;
}
示例6: _wp_post_thumbnail_html
/**
* Output HTML for the post thumbnail meta-box.
*
* @see wp-admin\includes\post.php
* @param int $thumbnail_id ID of the image used for thumbnail
* @return string html output
*/
function _wp_post_thumbnail_html($thumbnail_id = NULL)
{
global $_wp_additional_image_sizes, $post_ID;
$set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__('Set featured image') . '" href="' . esc_url(get_upload_iframe_src('image')) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
$content = sprintf($set_thumbnail_link, esc_html__('Set featured image'));
$image = nggdb::find_image($thumbnail_id);
$img_src = false;
// get the options
$ngg_options = nggGallery::get_option('ngg_options');
if ($image) {
if (is_array($_wp_additional_image_sizes) && isset($_wp_additional_image_sizes['post-thumbnail'])) {
// Use post thumbnail settings if defined
$width = absint($_wp_additional_image_sizes['post-thumbnail']['width']);
$height = absint($_wp_additional_image_sizes['post-thumbnail']['height']);
$mode = $_wp_additional_image_sizes['post-thumbnail']['crop'] ? 'crop' : '';
// check fo cached picture
$img_src = $image->cached_singlepic_file($width, $height, $mode);
}
// if we didn't use a cached image then we take the on-the-fly mode
if ($img_src == false) {
$img_src = trailingslashit(home_url()) . 'index.php?callback=image&pid=' . $image->pid . '&width=' . $width . '&height=' . $height . '&mode=crop';
}
$thumbnail_html = '<img width="266" src="' . $img_src . '" alt="' . $image->alttext . '" title="' . $image->alttext . '" />';
if (!empty($thumbnail_html)) {
$ajax_nonce = wp_create_nonce("set_post_thumbnail-{$post_ID}");
$content = sprintf($set_thumbnail_link, $thumbnail_html);
$content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__('Remove featured image') . '</a></p>';
}
}
return $content;
}
示例7: get_image_mrss_node
/**
* Get the XML <item> node corresponding to one single image
*
* @param $image The image object
*/
function get_image_mrss_node($image, $indent = "\t\t")
{
$ngg_options = nggGallery::get_option('ngg_options');
$tags = $image->get_tags();
$tag_names = '';
foreach ($tags as $tag) {
$tag_names .= $tag_names == '' ? $tag->name : ', ' . $tag->name;
}
$title = html_entity_decode(stripslashes($image->alttext));
$desc = html_entity_decode(stripslashes($image->description));
$thumbwidth = $ngg_options['thumbwidth'];
$thumbheight = $ngg_options['thumbfix'] ? $ngg_options['thumbheight'] : $thumbwidth;
$out = $indent . "<item>\n";
$out .= $indent . "\t<title><![CDATA[" . nggGallery::i18n($title, 'pic_' . $image->pid . '_alttext') . "]]></title>\n";
$out .= $indent . "\t<description><![CDATA[" . nggGallery::i18n($desc, 'pic_' . $image->pid . '_description') . "]]></description>\n";
$out .= $indent . "\t<link><![CDATA[" . $image->get_permalink() . "]]></link>\n";
$out .= $indent . "\t<guid>image-id:" . $image->pid . "</guid>\n";
$out .= $indent . "\t<media:content url='" . nextgen_esc_url($image->imageURL) . "' medium='image' />\n";
$out .= $indent . "\t<media:title><![CDATA[" . nggGallery::i18n($title, 'pic_' . $image->pid . '_alttext') . "]]></media:title>\n";
$out .= $indent . "\t<media:description><![CDATA[" . nggGallery::i18n($desc, 'pic_' . $image->pid . '_description') . "]]></media:description>\n";
$out .= $indent . "\t<media:thumbnail url='" . nextgen_esc_url($image->thumbURL) . "' width='" . $thumbwidth . "' height='" . $thumbheight . "' />\n";
$out .= $indent . "\t<media:keywords><![CDATA[" . nggGallery::i18n($tag_names) . "]]></media:keywords>\n";
$out .= $indent . "\t<media:copyright><![CDATA[Copyright (c) " . get_option("blogname") . " (" . site_url() . ")]]></media:copyright>\n";
$out .= $indent . "</item>\n";
return $out;
}
示例8: jig_init_shortcode
//.........这里部分代码省略.........
$recents_include = explode(',', str_replace(' ', '-', str_replace(', ', ',', $recents_include)));
foreach ($recents_include as &$recents_include_cat) {
if (!is_numeric($recents_include_cat)) {
$recents_include_cat = get_category_by_slug($recents_include_cat)->term_id;
}
}
$cat = implode(',', $recents_include);
}
if ($recents_tags != '') {
$tag = str_replace(' ', '-', str_replace(', ', ',', $recents_tags));
}
if ($recents_tree_depth === '' || $recents_tree_depth === 0 || !is_numeric($recents_tree_depth)) {
$recents_tree_depth = 10;
}
$posts = array();
$recents_post_type = strpos($recents_post_type, ',') === false ? $recents_post_type : explode(',', $recents_post_type);
$args = array('post_type' => $recents_post_type, 'order' => $order, 'orderby' => $orderby, 'post_status' => array('publish'), 'category' => $cat, 'tag' => $tag, 'numberposts' => $limit, 'ignore_sticky_posts' => 1);
if ($recents_placeholder === '') {
$args['meta_key'] = '_thumbnail_id';
}
if ($post_ids !== '') {
// Regular recent posts call when the results are automatic, depending on settings
$args['post__in'] = explode(',', $post_ids);
if (isset($orderby_original)) {
$args['orderby'] = 'post__in';
}
} elseif ($post_ids_exclude !== '') {
// Regular recent posts call when the results are automatic, depending on settings
global $post;
$post_ids_exclude = str_replace('current', $post->ID, $post_ids_exclude);
$args['post__not_in'] = explode(',', $post_ids_exclude);
}
if ($recents_sticky === 'yes') {
$args['post__in'] = get_option('sticky_posts');
} elseif ($recents_sticky === 'no') {
unset($args['post__in']);
$args['post__not_in'] = get_option('sticky_posts');
}
if ($recents_filter_tax !== 'none' && !empty($recents_filter_term)) {
// this is the proper way to query for posts using a specific taxonomy
$args['tax_query'] = array(array('taxonomy' => $recents_filter_tax, 'field' => 'slug', 'terms' => explode(',', str_replace(' ', '-', str_replace(', ', ',', $recents_filter_term)))));
}
if (!empty($recents_author)) {
if ($recents_author !== 'currently_logged_in') {
$recents_user = get_user_by('login', $recents_author);
$args['author'] = $recents_user->ID;
} else {
$recents_current_user_id = get_current_user_id();
if ($recents_current_user_id !== 0) {
$args['author'] = $recents_current_user_id;
} else {
return $this->frontend_stop(sprintf(__('You need to be logged in to view your posts.', 'jig_td'), $id));
}
}
}
if ($recents_date_range !== '') {
$recents_date_range = trim(str_replace(' ', '', $recents_date_range));
$recents_date_range_after = array('year' => substr($recents_date_range, 0, 4), 'month' => ltrim(substr($recents_date_range, 5, 2), '0'), 'day' => ltrim(substr($recents_date_range, 8, 2), '0'), 'hour' => 0);
$recents_date_range_before = array('hour' => 23, 'minute' => 59, 'second' => 59);
if (strtolower(substr($recents_date_range, 11)) !== 'today') {
$recents_date_range_before['year'] = substr($recents_date_range, 11, 4);
$recents_date_range_before['month'] = ltrim(substr($recents_date_range, 16, 2), '0');
$recents_date_range_before['day'] = ltrim(substr($recents_date_range, 19, 2), '0');
} else {
$recents_date_range_today = getdate();
$recents_date_range_before['year'] = $recents_date_range_today['year'];
示例9: nggShowRelatedImages
/**
* nggShowRelatedImages() - return related images based on category or tags
*
* @access public
* @param string $type could be 'tags' or 'category'
* @param integer $maxImages of images
* @return related gallery output or empty string if not tags/categories
* 20150309: fix: error when no tags in site.
* Few simplifications
*/
function nggShowRelatedImages($type = '', $maxImages = 0)
{
$ngg_options = nggGallery::get_option('ngg_options');
if ($type == '') {
$type = $ngg_options['appendType'];
$maxImages = $ngg_options['maxImages'];
}
$sluglist = array();
switch ($type) {
case 'tags':
$taglist = get_the_tags();
//Return array of tag objects, false on failure or empty
//This is a tag list for posts non Nextcellent tag lists.
if (!$taglist) {
return "";
}
foreach ($taglist as $tag) {
$sluglist[] = $tag->slug;
}
break;
case 'category':
$catlist = get_the_category();
//return array (empty if no categories)
if (empty($catlist)) {
return "";
}
foreach ($catlist as $cat) {
$sluglist[] = $cat->category_nicename;
}
break;
}
$sluglist = implode(',', $sluglist);
$out = nggShowRelatedGallery($sluglist, $maxImages);
return $out;
}
示例10: render_widget
/**
* Function to render the widget
*/
function render_widget($args, $widget_args = 1)
{
global $ngg_mrssw_plugin;
$ngg_options = nggGallery::get_option('ngg_options');
// Get the options
extract($args, EXTR_SKIP);
if (is_numeric($widget_args)) {
$widget_args = array('number' => $widget_args);
}
$widget_args = wp_parse_args($widget_args, array('number' => -1));
extract($widget_args, EXTR_SKIP);
$title = empty($this->options[$number]['widget_title']) ? __('Media RSS', 'nggallery') : $this->options[$number]['widget_title'];
$show_global_mrss = $this->options[$number]['show_global_mrss'];
$show_icon = $this->options[$number]['show_icon'];
// Compat reason for settings pre V1.4.X
$show_icon = empty($this->options[$number]['mrss_icon_url']) ? $show_icon : true;
$mrss_text = stripslashes($this->options[$number]['mrss_text']);
$mrss_title = strip_tags(stripslashes($this->options[$number]['mrss_title']));
echo '<!-- NextGen Gallery Media RSS -->';
echo $before_widget;
echo $before_title . $title . $after_title;
echo "<ul class='ngg-media-rss-widget'>\n";
if ($show_global_mrss) {
echo " <li>";
echo $this->get_mrss_link(nggMediaRss::get_mrss_url(), $show_icon, stripslashes($mrss_title), stripslashes($mrss_text), $ngg_options['usePicLens']);
echo "</li>\n";
}
echo "</ul>\n";
echo $after_widget;
echo '<!-- /NextGen Gallery Media RSS -->';
}