/**
  * create optional test nav menu
  * 
  * At least two custom menus should be created in order to test a theme
  * The standard Theme data file now ships with optimal menus built-in
  * This method actually makes sense with custom WXR files only
  * 
  * @since 0.2
  */
 private function create_test_menus()
 {
     $pages = get_all_page_ids();
     $items = array();
     foreach ($pages as $page_ID) {
         $info = get_page($page_ID);
         $items[$info->post_title] = get_permalink($page_ID);
     }
     # pick three random entries
     $random = array_rand($items, 3);
     # build menus
     $menus = array('Full Menu' => array('slug' => 'full-menu', 'menu_items' => $items), 'Short Menu' => array('slug' => 'short-menu', 'menu_items' => array($items[$random[0]], $items[$random[1]], $items[$random[2]])));
     # register menus
     foreach ($menus as $title => $data) {
         register_nav_menu($data['slug'], $title);
         if (false == is_nav_menu($title)) {
             $menu_ID = wp_create_nav_menu($title);
             foreach ($data['menu_items'] as $name => $url) {
                 $add_item = array('menu-item-type' => 'custom', 'menu-item-url' => $url, 'menu-item-title' => $name);
                 wp_update_nav_menu_item($menu_ID, 0, $add_item);
             }
             WP_CLI::success('Created menu ' . $title);
         }
     }
 }
Esempio n. 2
0
function ep_addVCCustomCss()
{
    $shortcodes_custom_css = '';
    //if is main-page
    if (is_page_template('main-page.php')) {
        $page_ids = get_all_page_ids();
        $current_page_id = get_the_ID();
        if (count($page_ids) > 0) {
            foreach ($page_ids as $page_id) {
                $separate_page = get_post_meta($page_id, "page-position-switch", true);
                if ($separate_page !== "0" && $page_id != $current_page_id) {
                    $shortcodes_custom_css .= get_post_meta($page_id, '_wpb_shortcodes_custom_css', true);
                }
            }
            if ($shortcodes_custom_css != '') {
                echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
                echo $shortcodes_custom_css;
                echo '</style>';
            }
        }
    } else {
        if (function_exists("is_shop")) {
            $shortcodes_custom_css = get_post_meta(woocommerce_get_page_id('shop'), '_wpb_shortcodes_custom_css', true);
            if (is_shop() && $shortcodes_custom_css != '') {
                echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
                echo $shortcodes_custom_css;
                echo '</style>';
            }
        }
    }
}
Esempio n. 3
0
	function widget( $args, $instance ) {
		extract( $args );

		$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages', 'lespaul_domain_adm' ) : $instance['title'], $instance, $this->id_base);
		$sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
		$exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];

		if ( $sortby == 'menu_order' )
			$sortby = 'menu_order, post_title';

		$pageIDs = get_all_page_ids();

		foreach ( $pageIDs as $pageID ) {
			if ( ! wm_restriction_page( $pageID ) ) {
				$exclude .= ( $exclude ) ? ( ',' . $pageID ) : ( $pageID );
			}
		}

		$out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) );

		if ( !empty( $out ) ) {
			echo $before_widget;
			if ( $title)
				echo $before_title . $title . $after_title;
		?>
		<ul>
			<?php echo $out; ?>
		</ul>
		<?php
			echo $after_widget;
		}
	}
Esempio n. 4
0
 function retro_sanitize_pages($input)
 {
     $pages = get_all_page_ids();
     if (in_array($input, $pages)) {
         return $input;
     } else {
         return '';
     }
 }
Esempio n. 5
0
 /**
  * @return array
  */
 public static function getPagesFromCurrentLanguage()
 {
     $page_ids = get_all_page_ids();
     $pages = array();
     foreach ($page_ids as $id) {
         //Check if WPML is installed and activated
         if (function_exists('icl_object_id')) {
             //Get page id from de current language and translations
             $current_lang_page_id = icl_object_id($id, 'page', true, ICL_LANGUAGE_CODE);
             //Check if $current_lang_page_id is original page (not a tranlated page) and status publish
             if ($id == $current_lang_page_id && get_post_status($id) == 'publish') {
                 $pages[$id] = get_the_title($id);
             }
         } else {
             $pages[$id] = get_the_title($id);
         }
     }
     return $pages;
 }
 public function handle($sql)
 {
     $sql->table('pages', function () {
         $ids = get_all_page_ids();
         $pages = array();
         foreach ($ids as $id) {
             $pages[] = get_page($id);
         }
         return $pages;
     });
     $sql->table('posts', function () {
         return get_posts(array('numberposts' => 10000));
     });
     $sql->table('menu', function () {
         return wp_get_nav_menus();
     });
     $sql->table('users', function () {
         return get_users();
     });
 }
	function &get_posts() {
		global $wpdb, $pagenow, $user_ID;

		do_action('pre_get_posts', array(&$this));

		// Shorthand.
		$q = $this->query_vars;	

		// First let's clear some variables
		$whichcat = '';
		$whichauthor = '';
		$whichpage = '';
		$result = '';
		$where = '';
		$limits = '';
		$distinct = '';
		$join = '';

		if ( !isset($q['posts_per_page']) || $q['posts_per_page'] == 0 )
			$q['posts_per_page'] = get_settings('posts_per_page');
		if ( !isset($q['what_to_show']) )
			$q['what_to_show'] = get_settings('what_to_show');
		if ( isset($q['showposts']) && $q['showposts'] ) {
			$q['showposts'] = (int) $q['showposts'];
			$q['posts_per_page'] = $q['showposts'];
		}
		if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) )
			$q['posts_per_page'] = $q['posts_per_archive_page'];
		if ( !isset($q['nopaging']) ) {
			if ($q['posts_per_page'] == -1) {
				$q['nopaging'] = true;
			} else {
				$q['nopaging'] = false;
			}
		}
		if ( $this->is_feed ) {
			$q['posts_per_page'] = get_settings('posts_per_rss');
			$q['what_to_show'] = 'posts';
		}

		if (isset($q['page'])) {
			$q['page'] = trim($q['page'], '/');
			$q['page'] = (int) $q['page'];
			$q['page'] = abs($q['page']);
		}
	
		$add_hours = intval(get_settings('gmt_offset'));
		$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
		$wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";

		// If a month is specified in the querystring, load that month
		if ( (int) $q['m'] ) {
			$q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']);
			$where .= ' AND YEAR(post_date)=' . substr($q['m'], 0, 4);
			if (strlen($q['m'])>5)
				$where .= ' AND MONTH(post_date)=' . substr($q['m'], 4, 2);
			if (strlen($q['m'])>7)
				$where .= ' AND DAYOFMONTH(post_date)=' . substr($q['m'], 6, 2);
			if (strlen($q['m'])>9)
				$where .= ' AND HOUR(post_date)=' . substr($q['m'], 8, 2);
			if (strlen($q['m'])>11)
				$where .= ' AND MINUTE(post_date)=' . substr($q['m'], 10, 2);
			if (strlen($q['m'])>13)
				$where .= ' AND SECOND(post_date)=' . substr($q['m'], 12, 2);
		}

		if ( (int) $q['hour'] ) {
			$q['hour'] = '' . intval($q['hour']);
			$where .= " AND HOUR(post_date)='" . $q['hour'] . "'";
		}

		if ( (int) $q['minute'] ) {
			$q['minute'] = '' . intval($q['minute']);
			$where .= " AND MINUTE(post_date)='" . $q['minute'] . "'";
		}

		if ( (int) $q['second'] ) {
			$q['second'] = '' . intval($q['second']);
			$where .= " AND SECOND(post_date)='" . $q['second'] . "'";
		}

		if ( (int) $q['year'] ) {
			$q['year'] = '' . intval($q['year']);
			$where .= " AND YEAR(post_date)='" . $q['year'] . "'";
		}

		if ( (int) $q['monthnum'] ) {
			$q['monthnum'] = '' . intval($q['monthnum']);
			$where .= " AND MONTH(post_date)='" . $q['monthnum'] . "'";
		}

		if ( (int) $q['day'] ) {
			$q['day'] = '' . intval($q['day']);
			$where .= " AND DAYOFMONTH(post_date)='" . $q['day'] . "'";
		}

		// Compat.  Map subpost to attachment.
		if ( '' != $q['subpost'] )
			$q['attachment'] = $q['subpost'];
		if ( '' != $q['subpost_id'] )
			$q['attachment_id'] = $q['subpost_id'];

		if ('' != $q['name']) {
			$q['name'] = sanitize_title($q['name']);
			$where .= " AND post_name = '" . $q['name'] . "'";
		} else if ('' != $q['pagename']) {
			$q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
			$page_paths = '/' . trim($q['pagename'], '/');
			$q['pagename'] = sanitize_title(basename($page_paths));
			$q['name'] = $q['pagename'];
			$page_paths = explode('/', $page_paths);
			foreach($page_paths as $pathdir)
				$page_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
				
			$all_page_ids = get_all_page_ids();
			$reqpage = 0;
			if (is_array($all_page_ids)) { foreach ( $all_page_ids as $page_id ) {
				$page = get_page($page_id);
				if ( $page->fullpath == $page_path ) {
					$reqpage = $page_id;
					break;
				}
			} }
			
			$where .= " AND (ID = '$reqpage')";
		} elseif ('' != $q['attachment']) {
			$q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
			$attach_paths = '/' . trim($q['attachment'], '/');
			$q['attachment'] = sanitize_title(basename($attach_paths));
			$q['name'] = $q['attachment'];
			$where .= " AND post_name = '" . $q['attachment'] . "'";
		}

		if ( (int) $q['w'] ) {
			$q['w'] = ''.intval($q['w']);
			$where .= " AND WEEK(post_date, 1)='" . $q['w'] . "'";
		}

		if ( intval($q['comments_popup']) )
			$q['p'] = intval($q['comments_popup']);

		// If a attachment is requested by number, let it supercede any post number.
		if ( ($q['attachment_id'] != '') && (intval($q['attachment_id']) != 0) )
			$q['p'] = (int) $q['attachment_id'];

		// If a post number is specified, load that post
		if (($q['p'] != '') && intval($q['p']) != 0) {
			$q['p'] =  (int) $q['p'];
			$where = ' AND ID = ' . $q['p'];
		}

		if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) {
			$q['page_id'] = intval($q['page_id']);
			$q['p'] = $q['page_id'];
			$where = ' AND ID = '.$q['page_id'];
		}

		// If a search pattern is specified, load the posts that match
		if (!empty($q['s'])) {
			$q['s'] = addslashes_gpc($q['s']);
			$search = ' AND (';
			$q['s'] = preg_replace('/, +/', ' ', $q['s']);
			$q['s'] = str_replace(',', ' ', $q['s']);
			$q['s'] = str_replace('"', ' ', $q['s']);
			$q['s'] = trim($q['s']);
			if ($q['exact']) {
				$n = '';
			} else {
				$n = '%';
			}
			if (!$q['sentence']) {
				$s_array = explode(' ',$q['s']);
				$q['search_terms'] = $s_array;
				$search .= '((post_title LIKE \''.$n.$s_array[0].$n.'\') OR (post_content LIKE \''.$n.$s_array[0].$n.'\'))';
				for ( $i = 1; $i < count($s_array); $i = $i + 1) {
					$search .= ' AND ((post_title LIKE \''.$n.$s_array[$i].$n.'\') OR (post_content LIKE \''.$n.$s_array[$i].$n.'\'))';
				}
				$search .= ' OR (post_title LIKE \''.$n.$q['s'].$n.'\') OR (post_content LIKE \''.$n.$q['s'].$n.'\')';
				$search .= ')';
			} else {
				$search = ' AND ((post_title LIKE \''.$n.$q['s'].$n.'\') OR (post_content LIKE \''.$n.$q['s'].$n.'\'))';
			}
		}

		// Category stuff

		if ((empty($q['cat'])) || ($q['cat'] == '0') || 
				// Bypass cat checks if fetching specific posts
				( $this->is_single || $this->is_page )) {
			$whichcat='';
		} else {
			$q['cat'] = ''.urldecode($q['cat']).'';
			$q['cat'] = addslashes_gpc($q['cat']);
			if (stristr($q['cat'],'-')) {
				// Note: if we have a negative, we ignore all the positives. It must
				// always mean 'everything /except/ this one'. We should be able to do
				// multiple negatives but we don't :-(
				$eq = '!=';
				$andor = 'AND';
				$q['cat'] = explode('-',$q['cat']);
				$q['cat'] = intval($q['cat'][1]);
			} else {
				$eq = '=';
				$andor = 'OR';
			}
			$join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) ";
			$cat_array = preg_split('/[,\s]+/', $q['cat']);
			$whichcat .= ' AND (category_id '.$eq.' '.intval($cat_array[0]);
			$whichcat .= get_category_children($cat_array[0], ' '.$andor.' category_id '.$eq.' ');
			for ($i = 1; $i < (count($cat_array)); $i = $i + 1) {
				$whichcat .= ' '.$andor.' category_id '.$eq.' '.intval($cat_array[$i]);
				$whichcat .= get_category_children($cat_array[$i], ' '.$andor.' category_id '.$eq.' ');
			}
			$whichcat .= ')';
			if ($eq == '!=') {
				$q['cat'] = '-'.$q['cat']; // Put back the knowledge that we are excluding a category.
			}
		}

		// Category stuff for nice URIs

		global $cache_categories;
		if ('' != $q['category_name']) {
			$cat_paths = '/' . trim(urldecode($q['category_name']), '/');
			$q['category_name'] = sanitize_title(basename($cat_paths));
			$cat_paths = explode('/', $cat_paths);
			foreach($cat_paths as $pathdir)
				$cat_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);

			$all_cat_ids = get_all_category_ids();
			$q['cat'] = 0; $partial_match = 0;
			foreach ( $all_cat_ids as $cat_id ) {
				$cat = get_category($cat_id);
				if ( $cat->fullpath == $cat_path ) {
					$q['cat'] = $cat_id;
					break;
				} elseif ( $cat->category_nicename == $q['category_name'] ) {
					$partial_match = $cat_id;
				}
			}
			
			//if we don't match the entire hierarchy fallback on just matching the nicename
			if (!$q['cat'] && $partial_match) {
				$q['cat'] = $partial_match;
			}			

			$tables = ", $wpdb->post2cat, $wpdb->categories";
			$join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) ";
			$whichcat = " AND (category_id = '" . $q['cat'] . "'";
			$whichcat .= get_category_children($q['cat'], " OR category_id = ");
			$whichcat .= ")";
		}

		// Author/user stuff

		if ((empty($q['author'])) || ($q['author'] == '0')) {
			$whichauthor='';
		} else {
			$q['author'] = ''.urldecode($q['author']).'';
			$q['author'] = addslashes_gpc($q['author']);
			if (stristr($q['author'], '-')) {
				$eq = '!=';
				$andor = 'AND';
				$q['author'] = explode('-', $q['author']);
				$q['author'] = ''.intval($q['author'][1]);
			} else {
				$eq = '=';
				$andor = 'OR';
			}
			$author_array = preg_split('/[,\s]+/', $q['author']);
			$whichauthor .= ' AND (post_author '.$eq.' '.intval($author_array[0]);
			for ($i = 1; $i < (count($author_array)); $i = $i + 1) {
				$whichauthor .= ' '.$andor.' post_author '.$eq.' '.intval($author_array[$i]);
			}
			$whichauthor .= ')';
		}

		// Author stuff for nice URIs

		if ('' != $q['author_name']) {
			if (stristr($q['author_name'],'/')) {
				$q['author_name'] = explode('/',$q['author_name']);
				if ($q['author_name'][count($q['author_name'])-1]) {
					$q['author_name'] = $q['author_name'][count($q['author_name'])-1];#no trailing slash
				} else {
					$q['author_name'] = $q['author_name'][count($q['author_name'])-2];#there was a trailling slash
				}
			}
			$q['author_name'] = sanitize_title($q['author_name']);
			$q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
			$whichauthor .= ' AND (post_author = '.intval($q['author']).')';
		}
		
		$where .= $search.$whichcat.$whichauthor;

		if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) {
			$q['order']='DESC';
		}

		// Order by
		if (empty($q['orderby'])) {
			$q['orderby']='date '.$q['order'];
		} else {
			// Used to filter values
			$allowed_keys = array('author', 'date', 'category', 'title', 'modified');
			$q['orderby'] = urldecode($q['orderby']);
			$q['orderby'] = addslashes_gpc($q['orderby']);
			$orderby_array = explode(' ',$q['orderby']);
			if (!in_array($orderby_array[0],$allowed_keys)) {
				$orderby_array[0] = 'date';
			}
			$q['orderby'] = $orderby_array[0].' '.$q['order'];
			if (count($orderby_array)>1) {
				for ($i = 1; $i < (count($orderby_array)); $i = $i + 1) {
					// Only allow certain values for safety
					if (in_array($orderby_array[$i],$allowed_keys)) {
						$q['orderby'] .= ',post_'.$orderby_array[$i].' '.$q['order'];
					}
				}
			}
		}

		$now = gmdate('Y-m-d H:i:59');
		
		//only select past-dated posts, except if a logged in user is viewing a single: then, if they
		//can edit the post, we let them through
		if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) {
			$where .= " AND post_date_gmt <= '$now'";
			$distinct = 'DISTINCT';
		}

		if ( $this->is_attachment ) {
			$where .= " AND (post_status = 'attachment')";
		} elseif ($this->is_page) {
			$where .= " AND (post_status = 'static')";
		} elseif ($this->is_single) {
			$where .= " AND (post_status != 'static')";
		} else {
			$where .= " AND (post_status = 'publish'";

			if (isset($user_ID) && ('' != intval($user_ID)))
				$where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')";
			else
				$where .= ')';				
		}

		if (! $this->is_attachment )
			$where .= " AND post_status != 'attachment'";

		// Apply filters on where and join prior to paging so that any
		// manipulations to them are reflected in the paging by day queries.
		$where = apply_filters('posts_where', $where);
		$join = apply_filters('posts_join', $join);

		// Paging
		if (empty($q['nopaging']) && ! $this->is_single && ! $this->is_page) {
			$page = abs(intval($q['paged']));
			if (empty($page)) {
				$page = 1;
			}

			if (($q['what_to_show'] == 'posts')) {
				$q['offset'] = abs(intval($q['offset']));
				if ( empty($q['offset']) ) {
					$pgstrt = '';
					$pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', ';
					$limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
				} else { // we're ignoring $page and using 'offset'
					$pgstrt = $q['offset'] . ', ';
					$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
				}
			} elseif ($q['what_to_show'] == 'days') {
				$startrow = $q['posts_per_page'] * (intval($page)-1);
				$start_date = $wpdb->get_var("SELECT max(post_date) FROM $wpdb->posts $join WHERE (1=1) $where GROUP BY year(post_date), month(post_date), dayofmonth(post_date) ORDER BY post_date DESC LIMIT $startrow,1");
				$endrow = $startrow + $q['posts_per_page'] - 1;
				$end_date = $wpdb->get_var("SELECT min(post_date) FROM $wpdb->posts $join WHERE (1=1) $where GROUP BY year(post_date), month(post_date), dayofmonth(post_date) ORDER BY post_date DESC LIMIT $endrow,1");

				if ($page > 1) {
					$where .= " AND post_date >= '$end_date' AND post_date <= '$start_date'";
				} else {
					$where .= " AND post_date >= '$end_date'";
				}
			}
		}

		// Apply post-paging filters on where and join.  Only plugins that
		// manipulate paging queries should use these hooks.
		$where = apply_filters('posts_where_paged', $where);
		$groupby = " $wpdb->posts.ID ";
		$groupby = apply_filters('posts_groupby', $groupby);
		$join = apply_filters('posts_join_paged', $join);
		$orderby = "post_" . $q['orderby'];
		$orderby = apply_filters('posts_orderby', $orderby); 
		$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1" . $where . " GROUP BY " . $groupby . " ORDER BY " . $orderby . " $limits";
		$this->request = apply_filters('posts_request', $request);

		$this->posts = $wpdb->get_results($this->request);

		// Check post status to determine if post should be displayed.
		if ( !empty($this->posts) && $this->is_single ) {
			$status = get_post_status($this->posts[0]);
			if ( ('publish' != $status) && ('static' != $status) ) {
				if ( ! (isset($user_ID) && ('' != intval($user_ID))) ) {
					// User must be logged in to view unpublished posts.
					$this->posts = array();
				} else {
					if ('draft' == $status) {
						// User must have edit permissions on the draft to preview.
						if (! current_user_can('edit_post', $this->posts[0]->ID)) {
							$this->posts = array();
						} else {
							$this->is_preview = true;
							$this->posts[0]->post_date = current_time('mysql');
						}
					} else {
						if (! current_user_can('read_post', $this->posts[0]->ID))
							$this->posts = array();
					}
				}
			} else {
				if (mysql2date('U', $this->posts[0]->post_date_gmt) > mysql2date('U', $now)) { //it's future dated
					$this->is_preview = true;
					if (!current_user_can('edit_post', $this->posts[0]->ID)) {
						$this->posts = array ( );
					}
				}
			}
		}

		update_post_caches($this->posts);

		$this->posts = apply_filters('the_posts', $this->posts);
		$this->post_count = count($this->posts);
		if ($this->post_count > 0) {
			$this->post = $this->posts[0];
		}
		
		// Save any changes made to the query vars.
		$this->query_vars = $q;
		return $this->posts;
	}
Esempio n. 8
0
        function form($instance)
        {
            //Defaults
            $instance = wp_parse_args((array) $instance, array('sortby' => 'post_title', 'title' => '', 'exclude' => ''));
            $title = esc_attr($instance['title']);
            $exclude = esc_attr($instance['exclude']);
            ?>
			<p><label for="<?php 
            echo $this->get_field_id('title');
            ?>
"><?php 
            _e('Title', 'wpdance');
            ?>
:</label> <input class="widefat" id="<?php 
            echo $this->get_field_id('title');
            ?>
" name="<?php 
            echo $this->get_field_name('title');
            ?>
" type="text" value="<?php 
            echo $title;
            ?>
" /></p>
			<p>
				<label for="<?php 
            echo $this->get_field_id('sortby');
            ?>
"><?php 
            _e('Sort by', 'wpdance');
            ?>
:</label>
				<select name="<?php 
            echo $this->get_field_name('sortby');
            ?>
" id="<?php 
            echo $this->get_field_id('sortby');
            ?>
" class="widefat">
					<option value="post_title"<?php 
            selected($instance['sortby'], 'post_title');
            ?>
><?php 
            _e('Page title', 'wpdance');
            ?>
</option>
					<option value="menu_order"<?php 
            selected($instance['sortby'], 'menu_order');
            ?>
><?php 
            _e('Page order', 'wpdance');
            ?>
</option>
					<option value="ID"<?php 
            selected($instance['sortby'], 'ID');
            ?>
><?php 
            _e('Page ID', 'wpdance');
            ?>
</option>
				</select>
			</p>
			<p>
			<?php 
            $page_ids = get_all_page_ids();
            $page_select = empty($instance['include']) ? array() : $instance['include'];
            ?>
			<select multiple="multiple" SIZE=5 name="<?php 
            echo $this->get_field_name('include');
            ?>
[]" class="widefat" style="height:auto;">
			<?php 
            foreach ($page_ids as $p) {
                ?>
			
				<?php 
                if (get_post_status($p) == 'private' || get_post_status($p) == 'publish' || get_post_status($p) == 'inherit') {
                    ?>
			
				<?php 
                    if (in_array($p, $page_select)) {
                        ?>
					<option value="<?php 
                        echo esc_attr($p);
                        ?>
" selected ><?php 
                        echo get_the_title($p);
                        ?>
</option>
				<?php 
                    } else {
                        ?>
					<option value="<?php 
                        echo esc_attr($p);
                        ?>
"><?php 
                        echo get_the_title($p);
                        ?>
</option>
				<?php 
                    }
                    ?>
	
				
				<?php 
                }
                ?>
				
			<?php 
            }
            ?>
			</select>
				
			</p>
	<?php 
        }
Esempio n. 9
0
<?php

/*------------------------------------------------------*/
/* BUTTON
/*------------------------------------------------------*/
vc_map(array("name" => __("Button", "js_composer"), "base" => 'vc_button', "icon" => "icon-wpb-ui-button", "category" => __('WPC Elements', 'js_composer'), "description" => __('Eye catching button', 'js_composer'), "save_always" => true, "params" => array(array('type' => 'textfield', 'heading' => __('Text on the button', 'js_composer'), 'holder' => 'button', 'class' => 'wpb_button', 'param_name' => 'title', 'value' => __('Text on the button', 'js_composer'), 'description' => __('Text on the button.', 'js_composer')), array('type' => 'vc_link', 'heading' => __('URL (Link)', 'js_composer'), 'param_name' => 'link', 'description' => __('Button link.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Button Color', 'js_composer'), 'param_name' => 'color', 'description' => __('Button color.', 'js_composer'), 'value' => array(__("Light", "js_composer") => "light", __("Ghost", "js_composer") => "ghost", __("Dark", "js_composer") => "dark", __("Primary Color", "js_composer") => "primary", __("Secondary Color", "js_composer") => "secondary", __("Custom BG Color", "js_composer") => "custom")), array("type" => "colorpicker", "class" => "", "heading" => __("Custom Button BG Color", "js_composer"), "param_name" => "button_custom_color", "value" => "", "dependency" => array('element' => "color", 'value' => array('custom'))), array('type' => 'dropdown', 'heading' => __('Size', 'js_composer'), 'param_name' => 'size', 'description' => __('Button size.', 'js_composer'), 'value' => array(__("Regular Size", "js_composer") => "regular", __("Large Size", "js_composer") => "large", __("Small Size", "js_composer") => "small")), array('type' => 'dropdown', 'heading' => __('Position', 'js_composer'), 'param_name' => 'button_position', 'description' => __('Button Position.', 'js_composer'), 'value' => array(__("Left", "js_composer") => "left", __("Center", "js_composer") => "center", __("Right", "js_composer") => "right")), array("type" => "textfield", "class" => "", "heading" => __("Custom Margin Top", "js_composer"), "param_name" => "margin_top", "value" => "", "description" => "Don't include \"px\" in your string. e.g \"50\""), array("type" => "textfield", "class" => "", "heading" => __("Custom Margin Bottom", "js_composer"), "param_name" => "margin_bottom", "value" => "", "description" => "Don't include \"px\" in your string. e.g \"50\""), array("type" => "textfield", "class" => "", "heading" => __("Custom Margin Left", "js_composer"), "param_name" => "margin_left", "value" => "", "description" => "Don't include \"px\" in your string. e.g \"50\""), array("type" => "textfield", "class" => "", "heading" => __("Custom Margin Right", "js_composer"), "param_name" => "margin_right", "value" => "", "description" => "Don't include \"px\" in your string. e.g \"50\""), array('type' => 'textfield', 'heading' => __('Extra class name', 'js_composer'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'js_composer'))), 'js_view' => 'VcButtonView'));
/*------------------------------------------------------*/
/* CHILD PAGE
/*------------------------------------------------------*/
$page_ids = get_all_page_ids();
$pages = array();
for ($i = 0; $i < count($page_ids); $i++) {
    $pages[get_the_title($page_ids[$i])] = $page_ids[$i];
}
vc_map(array("name" => __("Page Children", "js_composer"), "base" => 'wpc_childpage', "category" => __('WPC Elements', 'js_composer'), "description" => __('Display list page children', 'js_composer'), 'save_always' => true, 'save_always' => true, "params" => array(array('type' => 'textarea', 'holder' => 'h2', 'heading' => __('Widget Title', 'js_composer'), 'param_name' => 'widget_title', 'value' => '', 'description' => __('What text use as widget title. Leave blank if no title is needed.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Select your parent Page', 'js_composer'), 'param_name' => 'parrent_page_id', 'description' => __('The builder item will use parrent page ID to get page childen of that page.', 'js_composer'), 'value' => $pages), array('type' => 'dropdown', 'heading' => __('Order', 'js_composer'), 'param_name' => 'order', 'description' => __('Ascending or descending order', 'js_composer'), 'default' => 'DESC', 'value' => array(__("DESC", "js_composer") => "DESC", __("ASC", "js_composer") => "ASC")), array('type' => 'dropdown', 'heading' => __('Orderby', 'js_composer'), 'param_name' => 'orderby', 'description' => __('Sort retrieved posts/pages by parameter', 'js_composer'), 'default' => 'none', 'value' => array(__("None", "js_composer") => "none", __("ID", "js_composer") => "ID", __("Title", "js_composer") => "title", __("Name", "js_composer") => "name", __("Date", "js_composer") => "date", __("Page Order", "js_composer") => "menu_order")), array("type" => "textfield", "class" => "", "heading" => __("Specify page NOT to retrieve", "js_composer"), "param_name" => "exclude", "value" => "", "description" => "Use post ids, e.g: 16, 28"), array("type" => "textfield", "class" => "", "heading" => __("Number of posts", "js_composer"), "param_name" => "number", "value" => "9", "description" => "How many post to show?"), array('type' => 'dropdown', 'heading' => __('Display Mode', 'js_composer'), 'param_name' => 'layout', 'description' => __('The layout your page children being display', 'js_composer'), 'value' => array(__("Grid", "js_composer") => "grid", __("Carousel", "js_composer") => "carousel")), array('type' => 'dropdown', 'heading' => __('Column', 'js_composer'), 'param_name' => 'column', 'description' => __('How many column will be display on a row?', 'js_composer'), 'default' => '3', 'value' => array(__("2 Columns", "js_composer") => "2", __("3 Columns", "js_composer") => "3", __("4 Columns", "js_composer") => "4", __("5 Columns", "js_composer") => "5")), array("type" => "textfield", "class" => "", "heading" => __("Read More text", "js_composer"), "param_name" => "readmore_text", "value" => "Read More", "description" => "Custom your read more text, e.g. Read More, View Profile ..."), array('type' => 'textfield', 'heading' => __('Extra class name', 'js_composer'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'js_composer')))));
function wpc_shortcode_childpage($atts, $content = null)
{
    // extract(shortcode_atts(array(
    // 	'widget_title'    => '',
    // 	'parrent_page_id' => '',
    // 	'order'           => '',
    // 	'orderby'         => '',
    // 	'exclude'		  => '',
    // 	'layout'          => '',
    // 	'column'          => '',
    // 	'number'		  => '',
    // 	'readmore_text'   => '',
    // 	'el_class'        => ''
    // ), $atts));
    $atts = vc_map_get_attributes('wpc_childpage', $atts);
    extract($atts);
Esempio n. 10
0
 function cth_create_section_for_list_pages_select($value)
 {
     $all_page_ids = get_all_page_ids();
     cth_create_opening_tag($value);
     if (!empty($all_page_ids)) {
         echo "<select id='" . $value['id'] . "' class='post_form' name='" . $value['id'] . "'>\n";
         foreach ($all_page_ids as $key => $p_id) {
             $p_p = get_post($p_id);
             if ($p_p->post_status == 'publish') {
                 $selected = ' ';
                 if (get_option($value['id']) == $p_id) {
                     $selected = ' selected="selected" ';
                 } else {
                     if (get_option($value['id']) === FALSE && $value['default_title'] == $p_p->post_title) {
                         $selected = ' selected="selected" ';
                     }
                 }
                 echo '<option value="' . $p_id . '" ' . $selected . '/>' . $p_p->post_title . "</option>\n";
             }
         }
         echo "</select>\n </div>";
     }
     cth_create_closing_tag($value);
 }
Esempio n. 11
0
 function aft_plgn_options()
 {
     global $aft_options_array, $aft_options_by_array, $aft_themes_array;
     $cat_id = get_all_category_ids();
     $page_id = get_all_page_ids();
     $post_value = 0;
     $options_category = array();
     $options_page = array();
     if ($cat_id) {
         foreach ($cat_id as $id) {
             $options_category[get_cat_name($id)] = $post_value;
         }
     }
     if ($page_id) {
         foreach ($page_id as $id) {
             $page_data = get_page($id);
             $options_page[$page_data->post_title] = $post_value;
         }
     }
     // Default setup for option variable
     $aft_options_list = array('aft_is_enable' => 'true', 'aft_location' => 'bottom', 'aft_insertion' => 'all-article', 'rtp_is_custom_label' => 'false', 'rtp_custom_labels' => array(), 'rtp_custom_hints' => 0, 'rtp_theme' => 'default', 'rtp_can_rate' => 3, 'rtp_logged_by' => 3, 'rtp_use_shortcode' => 0);
     if (!get_option('aft_options_array')) {
         add_option('aft_options_array', $aft_options_list, '', 'yes');
     }
     $options_by_category = array(array($options_category));
     $options_by_page = array(array($options_page));
     $aft_options_by_list = array('category' => array($options_by_category), 'page' => array($options_by_page));
     if (!get_option('aft_options_by_array')) {
         add_option('aft_options_by_array', $aft_options_by_list, '', 'yes');
     }
     /* TODO: star images also will be changeable in the future */
     $theme_lists = array('default' => 'Default', 'couture_white' => 'Couture White', 'dark_red' => 'Dark Red', 'steel' => 'Steel', 'neutral_blue' => 'Neutral Blue');
     if (!get_option('aft_themes_array')) {
         add_option('aft_themes_array', $theme_lists, '', 'yes');
     } else {
         update_option('aft_themes_array', $theme_lists);
     }
     $aft_options_array = get_option('aft_options_array');
     $aft_options_by_array = get_option('aft_options_by_array');
     $aft_themes_array = get_option('aft_themes_array');
 }
Esempio n. 12
0
 /**
  * Return all pages.
  * (Post type page)
  *
  * @return array<Post>
  */
 public static function getPages($withoutEmpty = true)
 {
     foreach (get_all_page_ids() as $id) {
         $p = Post::find($id);
         if ($p->ID) {
             $pages[] = $p;
         }
     }
     if ($withoutEmpty) {
         $pages = array_filter($pages, function ($page) {
             return strlen($page->getContent());
         });
     }
     /*
      * Sort by title
      */
     /** @var Post $a */
     /** @var Post $b */
     usort($pages, function ($a, $b) {
         strcmp($a->getTitle(), $b->getTitle());
     });
     return $pages;
 }
Esempio n. 13
0
function themeum_startup_idea_settings()
{
    ?>
    <form id="themeum-startup-idea-options" role="form" method="post" action="options.php">

        <?php 
    settings_fields('themeum_startup_idea_options');
    ?>

        <h2><?php 
    _e('General Settings', 'themeum-startup-idea');
    ?>
</h2>
        <table class="form-table">
        	<tbody>

        		<tr>
        			<th scope="row"><label for="paypal_curreny_code"><?php 
    _e('Currency', 'themeum-startup-idea');
    ?>
</label></th>
        			<td>
        				<select id="paypal_curreny_code" name="paypal_curreny_code"> 
        					<?php 
    $currency_code = get_option('paypal_curreny_code');
    ?>
							<option <?php 
    if ($currency_code == "AUD") {
        echo 'selected';
    }
    ?>
 value="AUD"><?php 
    _e('Australian Dollar($)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "BRL") {
        echo 'selected';
    }
    ?>
 value="BRL"><?php 
    _e('Brazilian Real(R$)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "CAD") {
        echo 'selected';
    }
    ?>
 value="CAD"><?php 
    _e('Canadian Dollar($)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "CZK") {
        echo 'selected';
    }
    ?>
 value="CZK"><?php 
    _e('Czech Koruna(Kč)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "DKK") {
        echo 'selected';
    }
    ?>
 value="DKK"><?php 
    _e('Danish Krone(kr.)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "EUR") {
        echo 'selected';
    }
    ?>
 value="EUR"><?php 
    _e('Euro(€)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "HKD") {
        echo 'selected';
    }
    ?>
 value="HKD"><?php 
    _e('Hong Kong Dollar(HK$)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "HUF") {
        echo 'selected';
    }
    ?>
 value="HUF"><?php 
    _e('Hungarian Forint(Ft)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "ILS") {
        echo 'selected';
    }
    ?>
 value="ILS"><?php 
    _e('Israeli New Sheqel(₪)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "JPY") {
        echo 'selected';
    }
    ?>
 value="JPY"><?php 
    _e('Japanese Yen(¥)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "MYR") {
        echo 'selected';
    }
    ?>
 value="MYR"><?php 
    _e('Malaysian Ringgit(RM)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "MXN") {
        echo 'selected';
    }
    ?>
 value="MXN"><?php 
    _e('Mexican Peso(Mex$)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "NOK") {
        echo 'selected';
    }
    ?>
 value="NOK"><?php 
    _e('Norwegian Krone(kr)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "NZD") {
        echo 'selected';
    }
    ?>
 value="NZD"><?php 
    _e('New Zealand Dollar($)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "PHP") {
        echo 'selected';
    }
    ?>
 value="PHP"><?php 
    _e('Philippine Peso(₱)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "PLN") {
        echo 'selected';
    }
    ?>
 value="PLN"><?php 
    _e('Polish Zloty(zł)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "GBP") {
        echo 'selected';
    }
    ?>
 value="GBP"><?php 
    _e('Pound Sterling(£)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "RUB") {
        echo 'selected';
    }
    ?>
 value="RUB"><?php 
    _e('Russian Ruble(₽)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "SGD") {
        echo 'selected';
    }
    ?>
 value="SGD"><?php 
    _e('Singapore Dollar($)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "SEK") {
        echo 'selected';
    }
    ?>
 value="SEK"><?php 
    _e('Swedish Krona(kr)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "CHF") {
        echo 'selected';
    }
    ?>
 value="CHF"><?php 
    _e('Swiss Franc(CHF)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "TWD") {
        echo 'selected';
    }
    ?>
 value="TWD"><?php 
    _e('Taiwan New Dollar(角)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "THB") {
        echo 'selected';
    }
    ?>
 value="THB"><?php 
    _e('Thai Baht(฿)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "TRY") {
        echo 'selected';
    }
    ?>
 value="TRY"><?php 
    _e('Turkish Lira(TRY)', 'themeum-startup-idea');
    ?>
</option>
							<option <?php 
    if ($currency_code == "USD") {
        echo 'selected';
    }
    ?>
 value="USD"><?php 
    _e('U.S. Dollar($)', 'themeum-startup-idea');
    ?>
</option>
						</select>
        			</td>
        		</tr>

        		<tr>
					<th><label for="donate_page_percentage"><?php 
    _e('Per Project Commission', 'themeum-startup-idea');
    ?>
</label></th>
					<td>
					<input type="text" id="donate_page_percentage" class="regular-text" name="donate_page_percentage" value="<?php 
    echo esc_attr(get_option('donate_page_percentage'));
    ?>
" />%
					<p class="description"><small>Set project fee in percentage.</small></p>
					</td>
				</tr>

				<!--Profile page setting -->
        		<tr>
					<th scope="row"><label for="profile_page_id"><?php 
    _e('Profile/Dashboard Page', 'themeum-startup-idea');
    ?>
</label></th>
					<td>
						<?php 
    $profile_page_id = '<select name="profile_page_id" id="profile_page_id">';
    foreach (get_all_page_ids() as $value) {
        $page_title_all = get_post($value);
        if (get_option('profile_page_id') == $value) {
            $profile_page_id .= '<option selected="selected" value="' . $value . '">' . $page_title_all->post_title . '</option>';
        } else {
            $profile_page_id .= '<option value="' . $value . '">' . $page_title_all->post_title . '</option>';
        }
    }
    $profile_page_id .= '</select>';
    echo $profile_page_id;
    ?>
					</td>
				</tr>

				<tr>
					<th scope="row"><label for="paypal_payment_checkout_page_id"><?php 
    _e('Fund/Checkout Page', 'themeum-startup-idea');
    ?>
</label></th>
					<td>
						<?php 
    $paypal_payment_checkout_page_id = '<select name="paypal_payment_checkout_page_id" id="paypal_payment_checkout_page_id">';
    foreach (get_all_page_ids() as $value) {
        $page_title_all = get_post($value);
        if (get_option('paypal_payment_checkout_page_id') == $value) {
            $paypal_payment_checkout_page_id .= '<option selected="selected" value="' . $value . '">' . $page_title_all->post_title . '</option>';
        } else {
            $paypal_payment_checkout_page_id .= '<option value="' . $value . '">' . $page_title_all->post_title . '</option>';
        }
    }
    $paypal_payment_checkout_page_id .= '</select>';
    echo $paypal_payment_checkout_page_id;
    ?>
					</td>
				</tr>

				
				<tr>
					<th scope="row"><label for="payment_success_page"><?php 
    _e('Payment Success Return Page', 'themeum-startup-idea');
    ?>
</label></th>
					<td>
						<?php 
    $payment_success_page = '<select name="payment_success_page" id="payment_success_page">';
    foreach (get_all_page_ids() as $value) {
        $page_title_all = get_post($value);
        if (get_option('payment_success_page') == get_page_link($value)) {
            $payment_success_page .= '<option selected="selected" value="' . get_page_link($value) . '">' . $page_title_all->post_title . '</option>';
        } else {
            $payment_success_page .= '<option value="' . get_page_link($value) . '">' . $page_title_all->post_title . '</option>';
        }
    }
    $payment_success_page .= '</select>';
    echo $payment_success_page;
    ?>
					</td>
				</tr>

				<tr>
					<th scope="row"><label for="payment_cancel_page"><?php 
    _e('Payment Cancel Return Page', 'themeum-startup-idea');
    ?>
</label></th>
					<td>
						<?php 
    $payment_cancel_page = '<select name="payment_cancel_page" id="payment_cancel_page">';
    foreach (get_all_page_ids() as $value) {
        $page_title_all = get_post($value);
        if (get_option('payment_cancel_page') == get_page_link($value)) {
            $payment_cancel_page .= '<option selected="selected" value="' . get_page_link($value) . '">' . $page_title_all->post_title . '</option>';
        } else {
            $payment_cancel_page .= '<option value="' . get_page_link($value) . '">' . $page_title_all->post_title . '</option>';
        }
    }
    $payment_cancel_page .= '</select>';
    echo $payment_cancel_page;
    ?>
					</td>
				</tr>
        	</tbody>
        </table>

        <hr>
		<!-- Paypal Payment Settings -->
        <h2><?php 
    _e('Paypal Settings', 'themeum-startup-idea');
    ?>
</h2>
        <p><small><?php 
    _e('PayPal standard works by sending customers to PayPal where they can enter their payment information.', 'themeum-startup-idea');
    ?>
</small></p>
		<table class="form-table">
        	<tbody>
        		<tr>
        			<th scope="row"><label for="enable_paypal_payment"><?php 
    _e('Enable/Disable', 'themeum-startup-idea');
    ?>
</label></th>
        			<td>
        				<select  id="enable_paypal_payment" name="enable_paypal_payment">
							<?php 
    $enable_paypal = get_option('enable_paypal_payment');
    ?>
							<option value="0" <?php 
    if ($enable_paypal == '0') {
        echo 'selected';
    }
    ?>
 ><?php 
    _e('Disable', 'themeum-startup-idea');
    ?>
</option>
							<option value="1" <?php 
    if ($enable_paypal == '1') {
        echo 'selected';
    }
    ?>
 ><?php 
    _e('Enable', 'themeum-startup-idea');
    ?>
</option>
						</select>
        			</td>
        		</tr>

        		<tr valign="top">
					<th scope="row"><label for="paypal_email_address"><?php 
    _e('Paypal Email Address', 'themeum-startup-idea');
    ?>
</label></th>
					<td><input type="text" id="paypal_email_address" name="paypal_email_address" value="<?php 
    echo esc_attr(get_option('paypal_email_address'));
    ?>
" class="regular-text" /></td>
				</tr>

        		<tr>
					<th scope="row"><label for="paypal_mode"><?php 
    _e('PayPal', 'themeum-startup-idea');
    ?>
 </label></th>
					<td>
						<select  id="paypal_mode" name="paypal_mode">
							<?php 
    $mode_paypal = get_option('paypal_mode');
    ?>
						 	<option value="developer" <?php 
    if ($mode_paypal == 'developer') {
        echo 'selected';
    }
    ?>
 ><?php 
    _e('PayPal Sandbox', 'themeum-startup-idea');
    ?>
</option>
							<option value="real" <?php 
    if ($mode_paypal == 'real') {
        echo 'selected';
    }
    ?>
 ><?php 
    _e('PayPal', 'themeum-startup-idea');
    ?>
</option>
						</select>
					</td>
				</tr>
			</tbody>
        </table>

        <hr>
        <!-- Stipe Payment Settings -->
        <h2><?php 
    _e('Stipe Settings', 'themeum-startup-idea');
    ?>
</h2>
        <p><small><?php 
    _e('Stipe allows user to pay in crad like visa, mastard card etc.', 'themeum-startup-idea');
    ?>
</small></p>

        <table class="form-table">
        	<tbody>
        		<tr>
        			<th scope="row"><label for="enable_stripe_payment"><?php 
    _e('Enable/Disable', 'themeum-startup-idea');
    ?>
</label></th>
        			<td>
        				<select  id="enable_stripe_payment" name="enable_stripe_payment">
							<?php 
    $enable_stripe = get_option('enable_stripe_payment');
    ?>
							<option value="0" <?php 
    if ($enable_stripe == '0') {
        echo 'selected';
    }
    ?>
 ><?php 
    _e('Disable', 'themeum-startup-idea');
    ?>
</option>
							<option value="1" <?php 
    if ($enable_stripe == '1') {
        echo 'selected';
    }
    ?>
 ><?php 
    _e('Enable', 'themeum-startup-idea');
    ?>
</option>
						</select>
        			</td>
        		</tr>

        		<tr valign="top">
					<th scope="row"><label for="stripe_email_address"><?php 
    _e('Stipe Email Address', 'themeum-startup-idea');
    ?>
</label></th>
					<td><input type="text" id="stripe_email_address" name="stripe_email_address" value="<?php 
    echo esc_attr(get_option('stripe_email_address'));
    ?>
" class="regular-text" /></td>
				</tr>

				<tr valign="top">
					<th scope="row"><label for="stripe_secret_key"><?php 
    _e('Stipe Secret Key', 'themeum-startup-idea');
    ?>
</label></th>
					<td><input type="text" id="stripe_secret_key" name="stripe_secret_key" value="<?php 
    echo esc_attr(get_option('stripe_secret_key'));
    ?>
" class="regular-text" /></td>
				</tr>

		        <tr valign="top">
			        <th scope="row"><label for="stripe_secret_key"><?php 
    _e('Stipe Publishable Key', 'themeum-startup-idea');
    ?>
</label></th>
			        <td><input type="text" id="stripe_publishable_key" name="stripe_publishable_key" value="<?php 
    echo esc_attr(get_option('stripe_publishable_key'));
    ?>
" class="regular-text" /></td>
		        </tr>

				<tr valign="top">
					<th scope="row"><label for="webhooks"><?php 
    _e('Stipe Webhooks Receive URL', 'themeum-startup-idea');
    ?>
</label></th>
					<td>
						<p style="color:#3E8CDD;"><?php 
    echo plugins_url('payment/stripe-webhooks-receiver.php', dirname(__FILE__));
    ?>
</p>
						<small>This url for webhooks recevie. Set your webhooks recevie url in <a href="https://dashboard.stripe.com/account/webhooks" target="_blank">webhooks settings</a></small>
					</td>
				</tr>

				<tr valign="top">
					<th scope="row"><label for="stripe_site_name"><?php 
    _e('Stipe Pop-up Form Site Name', 'themeum-startup-idea');
    ?>
</label></th>
					<td><input type="text" id="stripe_site_name" name="stripe_site_name" value="<?php 
    echo esc_attr(get_option('stripe_site_name'));
    ?>
" class="regular-text" /></td>
				</tr>

				<tr valign="top">
					<th scope="row"><label for="stripe_desc"><?php 
    _e('Stipe Pop-up Form Description', 'themeum-startup-idea');
    ?>
</label></th>
					<td><input type="text" id="stripe_desc" name="stripe_desc" value="<?php 
    echo esc_attr(get_option('stripe_desc'));
    ?>
" class="regular-text" /></td>
				</tr>

				<tr valign="top">
					<th scope="row"><label for="stripe_logo"><?php 
    _e('Stipe Pop-up Form Logo ( image url )', 'themeum-startup-idea');
    ?>
</label></th>
					<td><input type="text" id="stripe_logo" name="stripe_logo" value="<?php 
    echo esc_attr(get_option('stripe_logo'));
    ?>
" class="regular-text" /></td>
				</tr>

			</tbody>
        </table>
	
		<hr>
		<!-- Fund/Checkout Page Setting -->
		<h2><?php 
    _e('Fund/Checkout Page Setting', 'themeum-startup-idea');
    ?>
</h2>
		<p><small><?php 
    _e('This is fund/checkout page content setting.', 'themeum-startup-idea');
    ?>
</small></p>
		<!-- Donate page title and text -->
		<table class="form-table">
        	<tbody>
        		<tr valign="top">
					<th scope="row"><label for="default_payment"><?php 
    _e('Default Payment System', 'themeum-startup-idea');
    ?>
</label></th>
					<td>
						<?php 
    $default_payment = esc_attr(get_option('default_payment'));
    ?>
						<input type="radio" name="default_payment" value="paypal" <?php 
    if ($default_payment == 'paypal') {
        echo 'checked';
    }
    ?>
 /><span> Paypal Payment</span>
						<input type="radio" name="default_payment" value="stripe" <?php 
    if ($default_payment == 'stripe') {
        echo 'checked';
    }
    ?>
 /><span> Stripe/Card Payment </span>
					</td>
				</tr>
				<tr>
					<th><label for="donate_page_notice_title"><?php 
    _e('Fund/Checkout Page Notice Title', 'themeum-startup-idea');
    ?>
</label></th>
					<td><input type="text" id="donate_page_notice_title" class="regular-text" name="donate_page_notice_title" value="<?php 
    echo esc_attr(get_option('donate_page_notice_title'));
    ?>
" /></td>
				</tr>
				<tr>
					<th><label for="donate_page_notice_content"><?php 
    _e('Fund/Checkout Page Notice Content', 'themeum-startup-idea');
    ?>
</label></th>
					<td><textarea id="donate_page_notice_content" name="donate_page_notice_content" rows="7" cols="50"><?php 
    echo esc_attr(get_option('donate_page_notice_content'));
    ?>
</textarea></td>
				</tr>
				<tr>
					<th><label for="donate_page_notice_text"><?php 
    _e('Fund/Checkout Page 2nd Title', 'themeum-startup-idea');
    ?>
</label></th>
					<td><input type="text" id="donate_page_notice_text" class="regular-text" name="donate_page_notice_text" value="<?php 
    echo esc_attr(get_option('donate_page_notice_text'));
    ?>
" /></td>
				</tr>

				<tr>
					<th><label for="donate_page_notice_text_content"><?php 
    _e('Fund/Checkout Page 2nd Content', 'themeum-startup-idea');
    ?>
</label></th>
					<td><textarea id="donate_page_notice_text_content" name="donate_page_notice_text_content" rows="7" cols="50"><?php 
    echo esc_attr(get_option('donate_page_notice_text_content'));
    ?>
</textarea></td>
				</tr>
				
				<?php 
    do_action('themeum_startup_idea_payment_method');
    ?>

        	</tbody>
        </table>

        <?php 
    submit_button();
    ?>
    </form>
    <?php 
}
Esempio n. 14
0
 /**
  * Returns array of detected URLs for theme templates
  *
  * @param string $theme_name
  * @return array
  */
 function get_theme_urls($theme_name)
 {
     $urls = array();
     $theme = w3tc_get_theme($theme_name);
     if ($theme && isset($theme['Template Files'])) {
         $front_page_template = false;
         if (get_option('show_on_front') == 'page') {
             $front_page_id = get_option('page_on_front');
             if ($front_page_id) {
                 $front_page_template_file = get_post_meta($front_page_id, '_wp_page_template', true);
                 if ($front_page_template_file) {
                     $front_page_template = basename($front_page_template_file, '.php');
                 }
             }
         }
         $home_url = w3_get_home_url();
         $template_files = (array) $theme['Template Files'];
         $mime_types = get_allowed_mime_types();
         $custom_mime_types = array();
         foreach ($mime_types as $mime_type) {
             list($type1, $type2) = explode('/', $mime_type);
             $custom_mime_types = array_merge($custom_mime_types, array($type1, $type2, $type1 . '_' . $type2));
         }
         foreach ($template_files as $template_file) {
             $link = false;
             $template = basename($template_file, '.php');
             /**
              * Check common templates
              */
             switch (true) {
                 /**
                  * Handle home.php or index.php or front-page.php
                  */
                 case !$front_page_template && $template == 'home':
                 case !$front_page_template && $template == 'index':
                 case !$front_page_template && $template == 'front-page':
                     /**
                      * Handle custom home page
                      */
                 /**
                  * Handle custom home page
                  */
                 case $template == $front_page_template:
                     $link = $home_url . '/';
                     break;
                     /**
                      * Handle 404.php
                      */
                 /**
                  * Handle 404.php
                  */
                 case $template == '404':
                     $permalink = get_option('permalink_structure');
                     if ($permalink) {
                         $link = sprintf('%s/%s/', $home_url, '404_test');
                     } else {
                         $link = sprintf('%s/?p=%d', $home_url, 999999999);
                     }
                     break;
                     /**
                      * Handle search.php
                      */
                 /**
                  * Handle search.php
                  */
                 case $template == 'search':
                     $link = sprintf('%s/?s=%s', $home_url, 'search_test');
                     break;
                     /**
                      * Handle date.php or archive.php
                      */
                 /**
                  * Handle date.php or archive.php
                  */
                 case $template == 'date':
                 case $template == 'archive':
                     $posts = get_posts(array('numberposts' => 1, 'orderby' => 'rand'));
                     if (is_array($posts) && count($posts)) {
                         $time = strtotime($posts[0]->post_date);
                         $link = get_day_link(date('Y', $time), date('m', $time), date('d', $time));
                     }
                     break;
                     /**
                      * Handle author.php
                      */
                 /**
                  * Handle author.php
                  */
                 case $template == 'author':
                     $author_id = false;
                     if (function_exists('get_users')) {
                         $users = get_users();
                         if (is_array($users) && count($users)) {
                             $user = current($users);
                             $author_id = $user->ID;
                         }
                     } else {
                         $author_ids = get_author_user_ids();
                         if (is_array($author_ids) && count($author_ids)) {
                             $author_id = $author_ids[0];
                         }
                     }
                     if ($author_id) {
                         $link = get_author_posts_url($author_id);
                     }
                     break;
                     /**
                      * Handle category.php
                      */
                 /**
                  * Handle category.php
                  */
                 case $template == 'category':
                     $category_ids = get_all_category_ids();
                     if (is_array($category_ids) && count($category_ids)) {
                         $link = get_category_link($category_ids[0]);
                     }
                     break;
                     /**
                      * Handle tag.php
                      */
                 /**
                  * Handle tag.php
                  */
                 case $template == 'tag':
                     $term_ids = get_terms('post_tag', 'fields=ids');
                     if (is_array($term_ids) && count($term_ids)) {
                         $link = get_term_link($term_ids[0], 'post_tag');
                     }
                     break;
                     /**
                      * Handle taxonomy.php
                      */
                 /**
                  * Handle taxonomy.php
                  */
                 case $template == 'taxonomy':
                     $taxonomy = '';
                     if (isset($GLOBALS['wp_taxonomies']) && is_array($GLOBALS['wp_taxonomies'])) {
                         foreach ($GLOBALS['wp_taxonomies'] as $wp_taxonomy) {
                             if (!in_array($wp_taxonomy->name, array('category', 'post_tag', 'link_category'))) {
                                 $taxonomy = $wp_taxonomy->name;
                                 break;
                             }
                         }
                     }
                     if ($taxonomy) {
                         $terms = get_terms($taxonomy, array('number' => 1));
                         if (is_array($terms) && count($terms)) {
                             $link = get_term_link($terms[0], $taxonomy);
                         }
                     }
                     break;
                     /**
                      * Handle attachment.php
                      */
                 /**
                  * Handle attachment.php
                  */
                 case $template == 'attachment':
                     $attachments = get_posts(array('post_type' => 'attachment', 'numberposts' => 1, 'orderby' => 'rand'));
                     if (is_array($attachments) && count($attachments)) {
                         $link = get_attachment_link($attachments[0]->ID);
                     }
                     break;
                     /**
                      * Handle single.php
                      */
                 /**
                  * Handle single.php
                  */
                 case $template == 'single':
                     $posts = get_posts(array('numberposts' => 1, 'orderby' => 'rand'));
                     if (is_array($posts) && count($posts)) {
                         $link = get_permalink($posts[0]->ID);
                     }
                     break;
                     /**
                      * Handle page.php
                      */
                 /**
                  * Handle page.php
                  */
                 case $template == 'page':
                     $pages_ids = get_all_page_ids();
                     if (is_array($pages_ids) && count($pages_ids)) {
                         $link = get_page_link($pages_ids[0]);
                     }
                     break;
                     /**
                      * Handle comments-popup.php
                      */
                 /**
                  * Handle comments-popup.php
                  */
                 case $template == 'comments-popup':
                     $posts = get_posts(array('numberposts' => 1, 'orderby' => 'rand'));
                     if (is_array($posts) && count($posts)) {
                         $link = sprintf('%s/?comments_popup=%d', $home_url, $posts[0]->ID);
                     }
                     break;
                     /**
                      * Handle paged.php
                      */
                 /**
                  * Handle paged.php
                  */
                 case $template == 'paged':
                     global $wp_rewrite;
                     if ($wp_rewrite->using_permalinks()) {
                         $link = sprintf('%s/page/%d/', $home_url, 1);
                     } else {
                         $link = sprintf('%s/?paged=%d', 1);
                     }
                     break;
                     /**
                      * Handle author-id.php or author-nicename.php
                      */
                 /**
                  * Handle author-id.php or author-nicename.php
                  */
                 case preg_match('~^author-(.+)$~', $template, $matches):
                     if (is_numeric($matches[1])) {
                         $link = get_author_posts_url($matches[1]);
                     } else {
                         $link = get_author_posts_url(null, $matches[1]);
                     }
                     break;
                     /**
                      * Handle category-id.php or category-slug.php
                      */
                 /**
                  * Handle category-id.php or category-slug.php
                  */
                 case preg_match('~^category-(.+)$~', $template, $matches):
                     if (is_numeric($matches[1])) {
                         $link = get_category_link($matches[1]);
                     } else {
                         $term = get_term_by('slug', $matches[1], 'category');
                         if (is_object($term)) {
                             $link = get_category_link($term->term_id);
                         }
                     }
                     break;
                     /**
                      * Handle tag-id.php or tag-slug.php
                      */
                 /**
                  * Handle tag-id.php or tag-slug.php
                  */
                 case preg_match('~^tag-(.+)$~', $template, $matches):
                     if (is_numeric($matches[1])) {
                         $link = get_tag_link($matches[1]);
                     } else {
                         $term = get_term_by('slug', $matches[1], 'post_tag');
                         if (is_object($term)) {
                             $link = get_tag_link($term->term_id);
                         }
                     }
                     break;
                     /**
                      * Handle taxonomy-taxonomy-term.php
                      */
                 /**
                  * Handle taxonomy-taxonomy-term.php
                  */
                 case preg_match('~^taxonomy-(.+)-(.+)$~', $template, $matches):
                     $link = get_term_link($matches[2], $matches[1]);
                     break;
                     /**
                      * Handle taxonomy-taxonomy.php
                      */
                 /**
                  * Handle taxonomy-taxonomy.php
                  */
                 case preg_match('~^taxonomy-(.+)$~', $template, $matches):
                     $terms = get_terms($matches[1], array('number' => 1));
                     if (is_array($terms) && count($terms)) {
                         $link = get_term_link($terms[0], $matches[1]);
                     }
                     break;
                     /**
                      * Handle MIME_type.php
                      */
                 /**
                  * Handle MIME_type.php
                  */
                 case in_array($template, $custom_mime_types):
                     $posts = get_posts(array('post_mime_type' => '%' . $template . '%', 'post_type' => 'attachment', 'numberposts' => 1, 'orderby' => 'rand'));
                     if (is_array($posts) && count($posts)) {
                         $link = get_permalink($posts[0]->ID);
                     }
                     break;
                     /**
                      * Handle single-posttype.php
                      */
                 /**
                  * Handle single-posttype.php
                  */
                 case preg_match('~^single-(.+)$~', $template, $matches):
                     $posts = get_posts(array('post_type' => $matches[1], 'numberposts' => 1, 'orderby' => 'rand'));
                     if (is_array($posts) && count($posts)) {
                         $link = get_permalink($posts[0]->ID);
                     }
                     break;
                     /**
                      * Handle page-id.php or page-slug.php
                      */
                 /**
                  * Handle page-id.php or page-slug.php
                  */
                 case preg_match('~^page-(.+)$~', $template, $matches):
                     if (is_numeric($matches[1])) {
                         $link = get_permalink($matches[1]);
                     } else {
                         $posts = get_posts(array('pagename' => $matches[1], 'post_type' => 'page', 'numberposts' => 1));
                         if (is_array($posts) && count($posts)) {
                             $link = get_permalink($posts[0]->ID);
                         }
                     }
                     break;
                     /**
                      * Try to handle custom template
                      */
                 /**
                  * Try to handle custom template
                  */
                 default:
                     $posts = get_posts(array('pagename' => $template, 'post_type' => 'page', 'numberposts' => 1));
                     if (is_array($posts) && count($posts)) {
                         $link = get_permalink($posts[0]->ID);
                     }
                     break;
             }
             if ($link && !is_wp_error($link)) {
                 $urls[$template] = $link;
             }
         }
     }
     return $urls;
 }
Esempio n. 15
0
/**
* Called from the install method, to install the base content
* that will be used at first for the simulator and for building the cms
* profile
* 
* After the initial processing the user will be able to trigger the processing
* via his plugin control panel or when a post is requested for the first time
*/
function wiziapp_generate_latest_content()
{
    global $wpdb;
    $done = false;
    $GLOBALS['WiziappLog']->write('info', "Parsing the latest content", "content");
    // Parse the latest posts
    $number_recents_posts = WiziappConfig::getInstance()->post_processing_batch_size;
    $recent_posts = wp_get_recent_posts($number_recents_posts);
    $last_post = -1;
    foreach ($recent_posts as $post) {
        $post_id = $post['ID'];
        $GLOBALS['WiziappLog']->write('info', "Processing post: {$post_id}", 'content.wiziapp_generate_latest_content');
        wiziapp_save_post($post_id);
        $last_post = $post_id;
    }
    $GLOBALS['WiziappLog']->write('info', "Processing all pages", 'content');
    $pages = get_all_page_ids();
    for ($p = 0, $total = count($pages); $p < $total; ++$p) {
        wiziapp_save_page($pages[$p]);
    }
    // Save the fact that we processed  $number_recents_posts and if the number of posts
    // in the blog is bigger, we need to continue
    $numposts = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_status = 'publish'");
    if ($numposts <= $number_recents_posts) {
        $last_post = -1;
    }
    add_option("wiziapp_last_processed", $last_post);
    $GLOBALS['WiziappLog']->write('info', "Finished parsing initial content", 'content');
    return $done;
}
Esempio n. 16
0
 public static function ajax_scan_start()
 {
     check_ajax_referer('amber_dashboard');
     $post_ids = get_posts(array('numberposts' => -1, 'fields' => 'ids'));
     $page_ids = get_all_page_ids();
     set_transient('amber_scan_pages', $page_ids, 24 * 60 * 60);
     set_transient('amber_scan_posts', $post_ids, 24 * 60 * 60);
     print count($post_ids) + count($page_ids);
     die;
 }
Esempio n. 17
0
function gdm_page_links_management()
{
    $gdmAllPages = get_all_page_ids();
    if (empty($_POST['gdm_submit'])) {
        gdm_page_links_management_form();
    } else {
        if (is_array($_POST['includedPages'])) {
            $excludedPages = array_diff($gdmAllPages, $_POST['includedPages']);
        } else {
            $excludedPages = $gdmAllPages;
        }
        update_option('gdm_excluded_pages', $excludedPages);
        ?>
<div id="message" class="updated fade"><p><strong><?php 
        _e('Page Links Updated');
        ?>
.</strong></p></div><?php 
        gdm_page_links_management_form();
    }
}
Esempio n. 18
0
function suffusion_get_excluded_pages($prefix)
{
    global ${$prefix};
    $inclusions = ${$prefix};
    $all_pages = get_all_page_ids();
    //get_pages('sort_column=menu_order');
    if ($all_pages == null) {
        $all_pages = array();
    }
    if ($inclusions && trim($inclusions) != '') {
        $include = explode(',', $inclusions);
        $translations = suffusion_get_wpml_lang_object_ids($include, 'post');
        foreach ($translations as $translation) {
            $include[count($include)] = $translation;
        }
    } else {
        $include = array();
    }
    // First we figure out which pages have to be excluded
    $exclude = array();
    foreach ($all_pages as $page) {
        if (!in_array($page, $include)) {
            $exclude[count($exclude)] = $page;
        }
    }
    // Now we need to figure out if these excluded pages are ancestors of any pages on the list. If so, we remove the descendants
    foreach ($all_pages as $page) {
        $ancestors = get_ancestors($page, 'page');
        foreach ($ancestors as $ancestor) {
            if (in_array($ancestor, $exclude)) {
                $exclude[count($exclude)] = $page;
            }
        }
    }
    $exclusion_list = implode(",", $exclude);
    return $exclusion_list;
}
Esempio n. 19
0
 /**
  * Возвращает ID всех страниц, в которых найдены соответствия строке
  * @param $strpos
  *
  * @return array
  */
 public function getArr_pagesIdsByContent($strpos)
 {
     $r = array();
     if (!is_array($strpos)) {
         $strpos = array($strpos);
     }
     $posts = get_all_page_ids();
     foreach ($posts as $id) {
         $content = get_post($id)->post_content;
         foreach ($strpos as $s) {
             if (strpos($content, $s) !== false) {
                 $r[] = $id;
             }
         }
     }
     return array_unique($r);
 }
Esempio n. 20
0
    function wpseo_sitemap_shortcode()
    {
        // ==============================================================================
        // General Variables
        $options = get_option('wpseosms');
        $checkOptions = get_option('wpseo_xml');
        $goHtm = '';
        //Hard Coded Styles
        if ($options['css-disable'] == '') {
            echo '<link rel="stylesheet" type="text/css" href="' . plugin_dir_url(__FILE__) . 'style.css" media="screen" />';
        }
        $goHtm .= '<!-- WP SEO HTML Sitemap Plugin Start --><div id="wpseo_sitemap" class="columns_' . $options['columns'] . '">';
        // ==============================================================================
        // Authors
        if ($checkOptions['disable_author_sitemap'] !== true) {
            $goHtm .= '<div id="sitemap_authors"><h3>' . __('Authors') . '</h3>
		<ul>';
            $authEx = implode(", ", get_users('orderby=nicename&meta_key=wpseo_excludeauthorsitemap&meta_value=on'));
            $goHtm .= wp_list_authors(array('exclude_admin' => false, 'exclude' => $authEx, 'echo' => false));
            $goHtm .= '</ul></div>';
        }
        // ==============================================================================
        // Pages
        $pageCheck = get_pages(array('exclude' => $options['pageID']));
        if (!empty($pageCheck) && $checkOptions['post_types-page-not_in_sitemap'] !== true) {
            $pageTitle = get_post_type_object('page');
            $pageTitle = $pageTitle->label;
            $goHtm .= '<div id="sitemap_pages"><h3>' . $pageTitle . '</h3>
		<ul>';
            $pageInc = '';
            $getPages = get_all_page_ids();
            foreach ($getPages as $pageID) {
                if ($pageID !== $options['pageID']) {
                    if (get_post_meta($pageID, '_yoast_wpseo_meta-robots-noindex', true) === '1' && get_post_meta($pageID, '_yoast_wpseo_sitemap-include', true) !== 'always' || get_post_meta($pageID, '_yoast_wpseo_sitemap-include', true) === 'never' || get_post_meta($pageID, '_yoast_wpseo_redirect', true) !== '') {
                        continue;
                    }
                    if ($pageInc == '') {
                        $pageInc = $pageID;
                        continue;
                    }
                    $pageInc .= ', ' . $pageID;
                }
            }
            $goHtm .= wp_list_pages(array('include' => $pageInc, 'title_li' => '', 'sort_column' => 'post_title', 'sort_order' => 'ASC', 'echo' => false));
            $goHtm .= '</ul></div>';
        }
        // ==============================================================================
        // Posts
        $postsTest = get_posts();
        if (!empty($postsTest) && $checkOptions['post_types-post-not_in_sitemap'] !== true) {
            $postTitle = get_post_type_object('post');
            $postTitle = $postTitle->label;
            if (get_option('show_on_front') == 'page') {
                $postsURL = get_permalink(get_option('page_for_posts'));
                $postTitle = get_the_title(get_option('page_for_posts'));
            } else {
                $postsURL = get_bloginfo('url');
            }
            $goHtm .= '<div id="sitemap_posts"><h3>';
            if ($postsURL !== '' && $postsURL !== get_permalink($options['pageID'])) {
                $goHtm .= '<a href="' . $postsURL . '">' . $postTitle . '</a>';
            } else {
                $goHtm .= $postTitle;
            }
            $goHtm .= '</h3><ul>';
            //Categories
            $cateEx = '';
            $getCate = get_option('wpseo_taxonomy_meta');
            if (!empty($getCate['category'])) {
                foreach ($getCate['category'] as $cateID => $item) {
                    if ($item['wpseo_noindex'] == 'noindex' || $item['wpseo_sitemap_include'] == 'never') {
                        if ($cateEx == '') {
                            $cateEx = $cateID;
                        } else {
                            $cateEx .= ', ' . $cateID;
                        }
                    }
                }
            }
            $cats = get_categories('exclude=' . $cateEx);
            foreach ($cats as $cat) {
                $goHtm .= "<li style='margin-top:10px;'><h4><a href='" . esc_url(get_term_link($cat)) . "'>" . $cat->cat_name . "</a></h4>";
                $goHtm .= "<ul>";
                query_posts('posts_per_page=-1&cat=' . $cat->cat_ID);
                while (have_posts()) {
                    the_post();
                    if (get_post_meta(get_the_ID(), '_yoast_wpseo_meta-robots-noindex', true) === '1' && get_post_meta(get_the_ID(), '_yoast_wpseo_sitemap-include', true) !== 'always' || get_post_meta(get_the_ID(), '_yoast_wpseo_sitemap-include', true) === 'never' || get_post_meta(get_the_ID(), '_yoast_wpseo_redirect', true) !== '') {
                        continue;
                    }
                    $category = get_the_category();
                    // Only display a post link once, even if it's in multiple categories
                    if ($category[0]->cat_ID == $cat->cat_ID) {
                        $goHtm .= '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
                    }
                }
                wp_reset_query();
                $goHtm .= "</ul>";
                $goHtm .= "</li>";
            }
            $goHtm .= '</ul></div>';
        }
        // ==============================================================================
        // Custom Post Types
        foreach (get_post_types(array('public' => true)) as $post_type) {
            $postsTest = get_posts('post_type=' . $post_type);
            if (!empty($postsTest)) {
                $checkSitemap = 'post_types-' . $post_type . '-not_in_sitemap';
                if (in_array($post_type, array('post', 'page', 'attachment')) || $checkOptions[$checkSitemap] === true) {
                    continue;
                }
                $postType = get_post_type_object($post_type);
                $postTypeLink = get_post_type_archive_link($postType->name);
                $goHtm .= '<div id="sitemap_' . str_replace(' ', '', strtolower($postType->labels->name)) . '">';
                if (!empty($postTypeLink)) {
                    $goHtm .= '<h3><a href="' . $postTypeLink . '">' . $postType->labels->name . '</a></h3>';
                } else {
                    $goHtm .= '<h3>' . $postType->labels->name . '</h3>';
                }
                $goHtm .= '<ul>';
                query_posts('post_type=' . $post_type . '&posts_per_page=-1&orderby=title&order=ASC');
                while (have_posts()) {
                    the_post();
                    if (get_post_meta(get_the_ID(), '_yoast_wpseo_meta-robots-noindex', true) === '1' && get_post_meta(get_the_ID(), '_yoast_wpseo_sitemap-include', true) !== 'always' || get_post_meta(get_the_ID(), '_yoast_wpseo_sitemap-include', true) === 'never' || get_post_meta(get_the_ID(), '_yoast_wpseo_redirect', true) !== '') {
                        continue;
                    }
                    $goHtm .= '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
                }
                wp_reset_query();
                $goHtm .= '</ul></div>';
            }
        }
        // ==============================================================================
        // Link To Sitemap
        if ($options['xml-link'] == 'yes') {
            $goHtm .= '<div id="sitemap_xml"><h3><a rel="alternate" href="' . site_url() . '/sitemap_index.xml" target="_blank">Sitemap XML</a></h3></div>';
        }
        // ==============================================================================
        // Add Credits Link
        if ($options['credits-link'] == 'yes') {
            $goHtm .= '<div id="credits_link">Sitemap by <a href="https://riseofweb.com/" target="_blank">Rise of the Web</a></div>';
        }
        $goHtm .= '<div class="wpseo_clearRow"></div></div><!-- WP SEO HTML Sitemap Plugin END -->';
        return $goHtm;
    }
Esempio n. 21
0
function vi_commentscode($content)
{
    $fboptn = get_option('fbcomment');
    $pages = $fboptn['pagesid'];
    $totalpages = explode(",", $pages);
    $allpage = get_all_page_ids();
    $allpage = array_diff($allpage, $totalpages);
    if (!isset($fboptn['html5'])) {
        $fboptn['html5'] = "off";
    }
    if (!isset($fboptn['pluginsite'])) {
        $fboptn['pluginsite'] = "off";
    }
    if (!isset($fboptn['posts'])) {
        $fboptn['posts'] = "off";
    }
    if (!isset($fboptn['pages'])) {
        $fboptn['pages'] = "off";
    }
    if (!isset($fboptn['homepage'])) {
        $fboptn['homepage'] = "off";
    }
    if (!isset($fboptn['count'])) {
        $fboptn['count'] = "off";
    }
    if (!isset($fboptn['countmsg'])) {
        $fboptn['countmsg'] = "0";
    }
    if (is_single() && $fboptn['posts'] == 'on' || is_page($allpage) && $fboptn['pages'] == 'on' || (is_home() || is_front_page()) && $fboptn['homepage'] == 'on') {
        if ($fboptn['appID'] != "") {
            if ($fboptn['count'] == 'on') {
                $commentcount = "<p class='commentcount'>";
                $commentcount .= "<fb:comments-count href=\"" . get_permalink() . "\"></fb:comments-count>" . " " . $fboptn['countmsg'] . "</p>";
                ?>
	
		<?php 
            }
            if ($fboptn['title'] != '') {
                $commenttitle = "<h3 class='coments-title'>";
                $commenttitle .= $fboptn['title'] . "</h3>";
            }
            $content .= "<!-- FB Comments For Wp: http://www.vivacityinfotech.com -->" . $commenttitle . $commentcount;
            if ($fboptn['html5'] == 'on') {
                $content .= "<div class=\"fb-comments\" data-href=\"" . get_permalink() . "\" data-numposts=\"" . $fboptn['num'] . "\" data-width=\"" . $fboptn['width'] . "\" data-colorscheme=\"" . $fboptn['scheme'] . "\"></div>";
            } else {
                $content .= "<fb:comments href=\"" . get_permalink() . "\" num_posts=\"" . $fboptn['num'] . "\" width=\"" . $fboptn['width'] . "\" colorscheme=\"" . $fboptn['scheme'] . "\"></fb:comments>";
            }
            if (!empty($fboptn['pluginsite'])) {
                if ($fboptn['pluginsite'] == 'on') {
                    $content .= '<p class="pluginsite">' . __('Facebook Comments Plugin Powered by', 'facebook-comment-by-vivacity') . '<a href="http://www.vivacityinfotech.net"  target="_blank" >Vivacity Infotech Pvt. Ltd.</a></p>';
                }
            }
        } else {
            $fb_adminUrl = get_admin_url() . "options-general.php?page=fbcomment";
            $content .= '<div class="error" style="color:#FF0000; font-weight:bold;">
            <p>' . __('Please Enter Your Facebook App ID. Required for FB Comments.', 'facebook-comment-by-vivacity') . ' <a href="' . $fb_adminUrl . '">' . __('Click here for FB Comments Settings page', 'facebook-comment-by-vivacity') . '</a></p>
            </div>';
        }
    }
    return $content;
}
Esempio n. 22
0
function optimizer_customizer_footer()
{
    ?>

<?php 
    if (is_customize_preview()) {
        ?>
		
        <div id="customizer_topbar">
        	<!--Show/Hide Topbar-->
            <span class="hidetop"><i class="fa fa-arrow-up"></i></span>

        	<!--Customizer Page Navigation-->
            <div id="customizer_nav">
            <label class="current_edit"><?php 
        _e('View', 'optimizer');
        ?>
 
            	<?php 
        if (is_front_page()) {
            ?>
<a><?php 
            _e('Front Page', 'optimizer');
            ?>
 <i></i></a><?php 
        }
        ?>
            	<?php 
        if (is_page()) {
            ?>
<a><?php 
            echo get_the_title(get_the_ID());
            ?>
 <i></i></a><?php 
        }
        ?>
                <?php 
        if (is_single()) {
            ?>
<a><?php 
            _e('Single Post', 'optimizer');
            ?>
 <i></i></a><?php 
        }
        ?>
                <?php 
        if (is_category()) {
            ?>
<a><?php 
            _e('Category Page', 'optimizer');
            ?>
 <i></i></a><?php 
        }
        ?>
                <?php 
        if (is_tag()) {
            ?>
<a><?php 
            _e('Tag Page', 'optimizer');
            ?>
 <i></i></a><?php 
        }
        ?>
                <?php 
        if (is_date()) {
            ?>
<a><?php 
            _e('Archive Page', 'optimizer');
            ?>
 <i></i></a><?php 
        }
        ?>
                <?php 
        if (is_author()) {
            ?>
<a><?php 
            _e('Author Page', 'optimizer');
            ?>
 <i></i></a><?php 
        }
        ?>
                <?php 
        if (is_search()) {
            ?>
<a><?php 
            _e('Search Page', 'optimizer');
            ?>
 <i></i></a><?php 
        }
        ?>
                <?php 
        if (is_404()) {
            ?>
<a><?php 
            _e('404 Page', 'optimizer');
            ?>
 <i></i></a><?php 
        }
        ?>
            </label>
                    <ul>
                    	<!--PAGES-->
                    	<li><strong><?php 
        _e('Pages:', 'optimizer');
        ?>
</strong></li>
                        <li><a href="<?php 
        echo home_url('/');
        ?>
"><?php 
        _e('Front Page', 'optimizer');
        ?>
</a></li>
                        <?php 
        $pageids = get_all_page_ids();
        foreach ($pageids as $page) {
            ?>
							<?php 
            if (get_post_status($page) == 'publish') {
                ?>
                            	<li><a href="<?php 
                echo get_the_permalink($page);
                ?>
"><?php 
                echo get_the_title($page);
                ?>
</a></li>
                            <?php 
            }
            ?>
                        <?php 
        }
        ?>
                        <!--POSTS-->
                        <?php 
        $postid = '';
        $postq = get_posts("post_type=post&numberposts=1&post_status=publish");
        $postid = $postq[0]->ID;
        ?>
                        <?php 
        $catid = '';
        $categories = get_categories(array('orderby' => 'count', 'number' => '1'));
        $catid = $categories[0]->term_id;
        ?>
                        <?php 
        $tagid = '';
        $tags = get_tags(array('orderby' => 'count', 'number' => '1'));
        if (!empty($tagid)) {
            $tagid = $tags[0]->name;
        }
        ?>
                        <?php 
        $dateid = '';
        ?>
                        <li><strong><?php 
        _e('Posts:', 'optimizer');
        ?>
</strong></li>
                        <li><a href="<?php 
        echo get_permalink($postid);
        ?>
"><?php 
        _e('Single Post', 'optimizer');
        ?>
</a></li>
                        <li><a href="<?php 
        echo home_url('/?cat=') . $catid;
        ?>
"><?php 
        _e('Category Page', 'optimizer');
        ?>
</a></li>
                        <li><a href="<?php 
        echo home_url('/?tag=') . $tagid;
        ?>
"><?php 
        _e('Tag Page', 'optimizer');
        ?>
</a></li>
<!--                        <li><a href="<?php 
        echo home_url('/?s=the');
        ?>
"><?php 
        _e('Archive Page', 'optimizer');
        ?>
</a></li>-->
                        <li><a href="<?php 
        echo home_url('/?author=1');
        ?>
"><?php 
        _e('Author Page', 'optimizer');
        ?>
</a></li>
                        <!--MISC-->
                        <li><strong><?php 
        _e('Other:', 'optimizer');
        ?>
</strong></li>
                        <li><a href="<?php 
        echo home_url('/?s=the');
        ?>
"><?php 
        _e('Search Page', 'optimizer');
        ?>
</a></li>
                        <li><a href="<?php 
        echo home_url('/nn49721667/');
        ?>
"><?php 
        _e('404 Page', 'optimizer');
        ?>
</a></li>
                    </ul>
            </div>
        </div>
		<!--CUSTOMIZER LOADER-->
		<div class="customizer_spinner"><div class="loader" title="0">
			  <svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
               width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
              <path opacity="0.2" fill="#000" d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946
                s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634
                c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"/>
              <path fill="#000" d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0
                C22.32,8.481,24.301,9.057,26.013,10.047z">
                <animateTransform attributeType="xml"
                  attributeName="transform"
                  type="rotate"
                  from="0 20 20"
                  to="360 20 20"
                  dur="0.5s"
                  repeatCount="indefinite"/>
                </path>
              </svg>
        </div></div>
        <?php 
        /*WIDGET ID TOOLTIP */
        ?>
        <div id="tooltipWindow"><div></div></div>
        
        	<?php 
        /* Add Widget Button for Frontpage*/
        ?>
            <?php 
        if (is_active_sidebar('front_sidebar') && is_front_page()) {
            ?>
                <div class="customizer_sidebar_holder has_sidebar" data-sidebar-id="front_sidebar">
                    <a class="add_widget_topage" title="<?php 
            _e('Add Widgets Here', 'optimizer');
            ?>
"><i class="fa fa-plus"></i></a>
                </div>
            <?php 
        }
        ?>
            
        <?php 
        /* Add Widget Button for Single Pages & Posts*/
        ?>
            <?php 
        if (is_singular()) {
            ?>
				<?php 
            if (!is_active_sidebar('sidebar')) {
                $has_sidebar = 'has_no_sidebar';
            } else {
                $has_sidebar = 'has_sidebar';
            }
            ?>
                    <div class="customizer_sidebar_holder <?php 
            echo $has_sidebar;
            ?>
" data-sidebar-id="sidebar">
                        <a class="add_widget_topage" title="<?php 
            _e('Add Widgets Here', 'optimizer');
            ?>
"><i class="fa fa-plus"></i></a>
                    </div>
                <?php 
        }
    }
    ?>


<?php 
}
Esempio n. 23
0
		function wm_shortcode_subpages( $atts, $content = null ) {
			extract( shortcode_atts( array(
				'depth'   => 0,
				'order'   => 'menu',
				'parents' => false,
				), $atts )
				);

			global $post, $page_exclusions;

			$sortColumns = array(
				'title' => 'post_title',
				'menu'  => 'menu_order',
				);

			$post        = ( is_home() ) ? ( get_post( get_option( 'page_for_posts' ) ) ) : ( $post );
			$parents     = ( $parents ) ? ( true ) : ( false );
			$parentPages = ( isset( $post->ancestors ) && $parents ) ? ( $post->ancestors ) : ( null ); //get all parent pages in array
			$grandparent = ( ! empty( $parentPages ) ) ? ( end( $parentPages ) ) : ( '' ); //get the first parent page (at the end of the array)
			$order       = ( in_array( trim( $order ), array_flip( $sortColumns ) ) ) ? ( $sortColumns[trim( $order )] ) : ( 'menu_order' );
			$depth       = absint( $depth );

			$pageIDs = get_all_page_ids();

			foreach ( $pageIDs as $pageID ) {
				if ( ! wm_restriction_page( $pageID ) ) {
					$page_exclusions .= ( $page_exclusions ) ? ( ',' . $pageID ) : ( $pageID );
				}
			}

			//subpages or siblings
			if ( $grandparent )
				$children = wp_list_pages( 'sort_column=' . $order . '&exclude=' . $page_exclusions . '&title_li=&child_of=' . $grandparent . '&echo=0&depth=' . $depth );
			else
				$children = wp_list_pages( 'sort_column=' . $order . '&exclude=' . $page_exclusions . '&title_li=&child_of=' . $post->ID . '&echo=0&depth=' . $depth );

			$out = ( $children ) ? ( '<ul class="sub-pages">' . str_replace( 'page_item', 'page_item', $children ) . '</ul>' ) : ( '' );

			//output
			return do_shortcode( $out );
		}
Esempio n. 24
0
function is_page_exist($_slug)
{
    //$pages = get_pages();
    $pages = get_all_page_ids();
    foreach ($pages as $page) {
        //$apage = $page -> post_name;
        $apage = get_post($post)->post_name;
        if ($apage == $_slug) {
            return $_slug;
        } else {
            return '';
        }
    }
}
Esempio n. 25
0
	function widget( $args, $instance ) {
		global $post, $page_exclusions;
		extract( $args );
		extract( $instance );

		$post    = ( is_home() ) ? ( get_post( get_option( 'page_for_posts' ) ) ) : ( $post );
		$parents = ( isset( $post->ancestors ) ) ? ( $post->ancestors ) : ( null ); //get all parent pages in array
		$order   = ( isset( $order ) ) ? ( $order ) : ( 'menu_order' );

		if ( $parent && ! empty( $parents ) )
			$grandparent = $parents[0]; //get direct parent
		elseif ( ! $parent && ! empty( $parents ) )
			$grandparent = end( $parents ); //get the first parent page (at the end of the array)
		else
			$grandparent = '';

		$titleAlt = ( $grandparent ) ? ( '<a href="' . get_permalink( $grandparent ) . '">' . get_the_title( $grandparent ) . '</a>' ) : ( '<a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a>' );

		$pageIDs = get_all_page_ids();

		foreach ( $pageIDs as $pageID ) {
			if ( ! wm_restriction_page( $pageID ) ) {
				$page_exclusions .= ( $page_exclusions ) ? ( ',' . $pageID ) : ( $pageID );
			}
		}

		//subpages or siblings
		if ( $grandparent )
			$children = wp_list_pages( 'sort_column=' . $order . '&exclude=' . $page_exclusions . '&title_li=&child_of=' . $grandparent . '&echo=0&depth=3' );
		else
			$children = wp_list_pages( 'sort_column=' . $order . '&exclude=' . $page_exclusions . '&title_li=&child_of=' . $post->ID . '&echo=0&depth=3' );

		//no need to display on archive pages, single post page and when there area no subpages
		if ( is_search() || is_404() || is_archive() || is_single() || ! $children )
			return;

		echo $before_widget;

		//if the title is not filled, no title will be displayed
		if ( isset( $title ) && '' != $title && ' ' != $title )
			echo $before_title . apply_filters( 'widget_title', $title ) . $after_title;
		elseif ( $titleAlt )
			echo $before_title . $titleAlt . $after_title;

		echo '<ul class="sub-nav">' . $children . '</ul> <!-- /sub-nav -->';

		echo $after_widget;
	} // /widget