function WP_Posts_List_Table() {
		global $post_type_object, $post_type, $wpdb;

		if ( !isset( $_REQUEST['post_type'] ) )
			$post_type = 'post';
		elseif ( in_array( $_REQUEST['post_type'], get_post_types( array( 'show_ui' => true ) ) ) )
			$post_type = $_REQUEST['post_type'];
		else
			wp_die( __( 'Invalid post type' ) );
		$_REQUEST['post_type'] = $post_type;

		$post_type_object = get_post_type_object( $post_type );

		if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
			$this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
				SELECT COUNT( 1 ) FROM $wpdb->posts
				WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' )
				AND post_author = %d
			", $post_type, get_current_user_id() ) );

			if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) )
				$_GET['author'] = get_current_user_id();
		}

		if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
			$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
			$this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) );
		}

		parent::WP_List_Table( array(
			'plural' => 'posts',
		) );
	}
Example #2
1
 static function enroll($is_manager)
 {
     global $wpdb, $user_ID, $user_email;
     $_course = new NamasteLMSCourseModel();
     $message = '';
     // enroll in course
     $course = $_course->select($_POST['course_id']);
     // course fee?
     $fee = get_post_meta($course->ID, 'namaste_fee', true);
     // When fee is paid, enrollment is automatic so this is just fine here
     if (!empty($fee)) {
         $fee = apply_filters('namaste-coupon-applied', $fee);
     }
     // coupon code from other plugin?
     if ($fee > 0 and !$is_manager) {
         wp_die("You can't enroll yourself in a course when there is a fee");
     }
     $enroll_mode = get_post_meta($course->ID, 'namaste_enroll_mode', true);
     // if already enrolled, just skip this altogether
     if (!NamasteLMSStudentModel::is_enrolled($user_ID, $course->ID)) {
         // depending on mode, status will be either 'pending' or 'enrolled'
         $status = $enroll_mode == 'free' ? 'enrolled' : 'pending';
         $_course->enroll($user_ID, $course->ID, $status);
         if ($enroll_mode == 'free') {
             $message = sprintf(__('You enrolled in "%s"', 'namaste'), $course->post_title);
         } else {
             $message = __('Thank you for your interest in enrolling this course. A manager will review your application.', 'namaste');
         }
     } else {
         $message = __('You have already enrolled in this course', 'namaste');
     }
     return $message;
 }
Example #3
0
 /**
  * The autoloader class
  *
  * @param string $class_name
  *
  * @return bool
  * @since 1.0
  */
 function wpbgdc_autoloader($class_name)
 {
     // do not include classes that already exist
     if (class_exists($class_name)) {
         return true;
     }
     $file = trailingslashit(dirname(__FILE__)) . 'classes/' . strtolower($class_name) . '.php';
     if (is_file($file)) {
         require_once $file;
         return true;
     }
     if (false === stripos($class_name, 'Google')) {
         return false;
     }
     $file = trailingslashit(dirname(__FILE__)) . 'classes/' . str_replace('_', '/', $class_name) . '.php';
     if (is_file($file)) {
         try {
             require_once $file;
         } catch (Exception $e) {
             $message = '<div class="error"><p>' . $e->getMessage() . '</p></div>';
             wp_die($message);
         }
         return true;
     }
     return false;
 }
Example #4
0
/**
 * Determines if the available space defined by the admin has been exceeded by the user.
 *
 * @deprecated 3.0.0
 * @see is_upload_space_available()
 */
function wpmu_checkAvailableSpace()
{
    _deprecated_function(__FUNCTION__, '3.0', 'is_upload_space_available()');
    if (!is_upload_space_available()) {
        wp_die(__('Sorry, you must delete files before you can upload any more.'));
    }
}
Example #5
0
function pado_options()
{
    // Check that the user is able to view this page.
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.', 'pressapps'));
    }
    ?>

	<div class="wrap">
		<div id="icon-themes" class="icon32"></div>
		<h2><?php 
    _e('Document Settings', 'pressapps');
    ?>
</h2>

		<form action="options.php" method="post">
			<?php 
    settings_fields('pado_setup_options');
    ?>
			<?php 
    do_settings_sections('pado_setup_options');
    ?>
			<?php 
    submit_button();
    ?>
		</form>

	</div>
<?php 
}
Example #6
0
function gmw_fl_update_members_database_table()
{
    if (empty($_POST['gmw_action']) || $_POST['gmw_action'] != 'members_db_table_update') {
        return;
    }
    //look for nonce
    if (empty($_POST['gmw_members_db_table_update_nonce'])) {
        wp_die(__('Cheatin\' eh?!', 'GMW'));
    }
    //varify nonce
    if (!wp_verify_nonce($_POST['gmw_members_db_table_update_nonce'], 'gmw_members_db_table_update_nonce')) {
        wp_die(__('Cheatin\' eh?!', 'GMW'));
    }
    global $wpdb;
    $dbTable = $wpdb->get_row("SELECT * FROM wppl_friends_locator");
    //Add column if not present.
    if (!isset($dbTable->street_name)) {
        $wpdb->query("ALTER TABLE wppl_friends_locator ADD COLUMN `street_name` varchar(128) NOT NULL AFTER `long`");
    }
    if (!isset($dbTable->street_number)) {
        $wpdb->query("ALTER TABLE wppl_friends_locator ADD COLUMN `street_number` varchar(60) NOT NULL AFTER `long`");
    }
    if (!isset($dbTable->feature)) {
        $wpdb->query("ALTER TABLE wppl_friends_locator ADD COLUMN `feature` tinyint NOT NULL default '0' AFTER `member_id`");
    }
    update_option("gmw_fl_db_version", GMW_FL_DB_VERSION);
    wp_safe_redirect(admin_url('admin.php?page=gmw-add-ons&gmw_notice=members_db_table_updated&gmw_notice_status=updated'));
    exit;
}
function load_more_posts_callback()
{
    check_ajax_referer('pan_travel_blog', 'token');
    try {
        $offset = $_POST['offset'];
        $number = $_POST['number'];
        $loop = new WP_Query(array('post_type' => 'travel_blogs', 'post_status' => 'publish', 'order' => 'DESC', 'orderby' => 'meta_value', 'meta_key' => 'travel_blog_start_date', 'offset' => $offset, 'posts_per_page' => $number));
        if ($loop->have_posts()) {
            while ($loop->have_posts()) {
                $loop->the_post();
                ?>
				<?php 
                get_template_part('parts/content', 'travelblog');
                ?>
			<?php 
            }
        } else {
            ?>
			<p><?php 
            _e('Sorry, no posts matched your criteria.');
            ?>
</p>
		<?php 
        }
        wp_reset_postdata();
    } catch (Exception $e) {
        echo 'Errors';
    }
    wp_die();
}
Example #8
0
 /**
  * Dispatch request for settings page
  *
  * @param none
  * @return void
  */
 public function dispatch()
 {
     if (!current_user_can('manage_network_options')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     self::render();
 }
    public function printUi()
    {
        if (!$this->currentUserCanManageLicense()) {
            wp_die("You don't have sufficient permissions to manage licenses for this product.");
        }
        $action = isset($_REQUEST['license_action']) ? strval($_REQUEST['license_action']) : '';
        if (empty($action)) {
            $action = 'show_license';
        }
        check_admin_referer($action);
        $this->triedLicenseKey = isset($_POST['license_key']) ? trim(strval($_POST['license_key'])) : $this->licenseManager->getLicenseKey();
        $this->printHeader();
        $this->dispatchAction($action);
        $this->printLogo();
        $this->printTabList();
        ?>
		<div class="wrap" id="wslm-section-holder">
			<div id="section-current-license" class="wslm-section">
				<?php 
        $this->tabCurrentLicense();
        ?>
			</div>
			<div id="section-manage-sites" class="wslm-section hidden">
				<?php 
        $this->tabManageSites();
        ?>
			</div>
		</div> <!-- #wslm-section-holder -->
		<?php 
        exit;
    }
    public function printUi()
    {
        if (!$this->currentUserCanManageLicense()) {
            wp_die("You don't have sufficient permissions to manage licenses for this product.");
        }
        $action = isset($_REQUEST['license_action']) ? strval($_REQUEST['license_action']) : '';
        if (empty($action)) {
            $action = 'show_license';
        }
        check_admin_referer($action);
        $this->triedLicenseKey = isset($_POST['license_key']) ? trim(strval($_POST['license_key'])) : $this->licenseManager->getLicenseKey();
        if (isset($_REQUEST['tab']) && is_string($_REQUEST['tab']) && array_key_exists($_REQUEST['tab'], $this->tabs)) {
            $this->currentTab = $_REQUEST['tab'];
        }
        $this->printHeader();
        $this->dispatchAction($action);
        $this->printLogo();
        $this->printTabList();
        ?>
		<div class="wrap" id="wslm-section-holder">
			<?php 
        foreach ($this->tabs as $id => $tab) {
            printf('<div id="section-%1$s" class="wslm-section%2$s">', esc_attr($id), $this->currentTab !== $id ? ' hidden' : '');
            call_user_func($tab['callback']);
            echo '</div>';
        }
        ?>
		</div> <!-- #wslm-section-holder -->
		<?php 
        exit;
    }
Example #11
0
 public function ajax_image_crop()
 {
     $res = false;
     if (!current_user_can('edit_posts') || empty($_REQUEST["nonce"]) || !wp_verify_nonce($_REQUEST["nonce"], 'pe_theme_image_crop')) {
         wp_send_json_error();
         wp_die(0);
     }
     $id = $_REQUEST["id"];
     $idx = $_REQUEST["idx"];
     $size = $_REQUEST["size"];
     list($w, $h) = explode("x", $size);
     $crop = $_REQUEST["crop"];
     $orig = $_REQUEST["orig"];
     $res = $this->master->image->crop($orig, $crop, $w, $h);
     if (!empty($res["cburl"])) {
         $res["idx"] = absint($idx);
         $meta = get_post_meta($id, PE_THEME_META, true);
         if (empty($meta)) {
             $meta = new StdClass();
             $meta->thumbnails = new StdClass();
         }
         $meta->thumbnails->thumbs[$size] = $crop;
         update_post_meta($id, PE_THEME_META, $this->update_attachment_metadata($meta, $id, null));
     }
     wp_send_json_success($res);
     wp_die(0);
 }
Example #12
0
    public function show_settings()
    {
        if (!current_user_can('manage_options')) {
            wp_die(__('You do not have sufficient permissions to access this page.'));
        }
        $out = '';
        if (!isset($_GET['tab'])) {
            $_GET['tab'] = 'general';
        }
        // check for changed settings
        if (isset($_GET['settings-updated'])) {
            // show "settings saved" message
            $out .= '<div id="message" class="updated">
				<p><strong>' . __('Settings saved.', 'event-list') . '</strong></p>
			</div>';
            // check feed rewrite status and update it if required
            if ('feed' == $_GET['tab']) {
                require_once EL_PATH . 'includes/feed.php';
                EL_Feed::get_instance()->update_feed_rewrite_status();
            }
        }
        // normal output
        $out .= '
				<div class="wrap">
				<div id="icon-edit-pages" class="icon32"><br /></div><h2>' . __('Event List Settings', 'event-list') . '</h2>';
        $out .= $this->show_tabs($_GET['tab']);
        $out .= '<div id="posttype-page" class="posttypediv">';
        $out .= $this->functions->show_option_form($_GET['tab']);
        $out .= '
				</div>
			</div>';
        echo $out;
    }
Example #13
0
 function process_submission()
 {
     if (!current_user_can('pp_manage_settings')) {
         wp_die(__ppw('Cheatin&#8217; uh?'));
     }
     if (!empty($_REQUEST['pp_refresh_updates'])) {
         delete_site_transient('update_plugins');
         pp_get_version_info(true, false, true);
         wp_update_plugins();
         wp_redirect(admin_url('admin.php?page=pp-settings&pp_refresh_done=1'));
         exit;
     }
     if (!empty($_REQUEST['pp_renewal'])) {
         $opt_val = get_option('pp_support_key');
         $renewal_token = !is_array($opt_val) || count($opt_val) < 2 ? '' : substr($opt_val[1], 0, 16);
         $url = site_url('');
         $arr_url = parse_url($url);
         $site = urlencode(str_replace($arr_url['scheme'] . '://', '', $url));
         wp_redirect('http://presspermit.com/renewal/?pkg=press-permit-pro&site=' . $site . '&rt=' . $renewal_token);
         exit;
     }
     if (!empty($_REQUEST['pp_upload_config']) || !empty($_REQUEST['pp_support_forum'])) {
         require_once dirname(__FILE__) . '/admin/support_pp.php';
         $args = array();
         if (isset($_REQUEST['post_id'])) {
             $args['post_id'] = (int) $_REQUEST['post_id'];
         }
         if (isset($_REQUEST['term_taxonomy_id'])) {
             $args['term_taxonomy_id'] = (int) $_REQUEST['term_taxonomy_id'];
         }
         if (!empty($_REQUEST['pp_support_forum'])) {
             //$forum = ( ! empty( $_REQUEST['pp_forum'] ) ) ? sanitize_url($_REQUEST['pp_forum']) : 'pp2-technical-issues';
             $url = "http://presspermit.com/forums/";
             if (!empty($_REQUEST['pp_topic'])) {
                 $url = add_query_arg('pp_topic', $_REQUEST['pp_topic'], $url);
             }
             wp_redirect($url);
         }
         $success = _pp_support_upload($args);
         if (empty($_REQUEST['pp_support_forum'])) {
             if (-1 === $success) {
                 $flag = 'pp_config_no_change';
             } elseif ($success) {
                 $flag = 'pp_config_uploaded';
             } else {
                 $flag = 'pp_config_failed';
             }
             wp_redirect(admin_url("admin.php?page=pp-settings&{$flag}=1"));
         }
         exit;
     }
     if (isset($_POST['pp_submit'])) {
         $this->handle_submission('update');
     } elseif (isset($_POST['pp_defaults'])) {
         $this->handle_submission('default');
     } elseif (isset($_POST['pp_role_usage_defaults'])) {
         delete_option('pp_role_usage');
         pp_refresh_options();
     }
 }
 /**
  * register_post_types()
  *
  * Static function to register the assignments post types, taxonomies and capabilities.
  */
 function register_post_types()
 {
     $assignment_post_def = array('label' => __('Assignments', 'bpsp'), 'singular_label' => __('Assignment', 'bpsp'), 'description' => __('BuddyPress ScholarPress Courseware Assignments', 'bpsp'), 'public' => BPSP_DEBUG, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_ui' => BPSP_DEBUG, 'capability_type' => 'assignment', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array('title', 'editor', 'author', 'custom-fields'), 'taxonomies' => array('course_id', 'group_id'));
     if (!register_post_type('assignment', $assignment_post_def)) {
         wp_die(__('BuddyPress Courseware error while registering assignment post type.', 'bpsp'));
     }
 }
 public function ajax_refresh_captcha()
 {
     $length = 5;
     $charset = 'abcdefghijklmnpqrstuvwxyz123456789';
     $phrase = '';
     $chars = str_split($charset);
     for ($i = 0; $i < $length; $i++) {
         $phrase .= $chars[array_rand($chars)];
     }
     $resp = $resp2 = array();
     $resp['txt_color_st'] = isset($_POST['txt_color_st']) ? Uiform_Form_Helper::sanitizeInput($_POST['txt_color_st']) : '';
     $resp['txt_color'] = isset($_POST['txt_color']) ? Uiform_Form_Helper::sanitizeInput($_POST['txt_color']) : '';
     $resp['background_st'] = isset($_POST['background_st']) ? Uiform_Form_Helper::sanitizeInput($_POST['background_st']) : '';
     $resp['background_color'] = isset($_POST['txt_color_st']) ? Uiform_Form_Helper::sanitizeInput($_POST['background_color']) : '';
     $resp['distortion'] = isset($_POST['distortion']) ? Uiform_Form_Helper::sanitizeInput($_POST['distortion']) : '';
     $resp['behind_lines_st'] = isset($_POST['behind_lines_st']) ? Uiform_Form_Helper::sanitizeInput($_POST['behind_lines_st']) : '';
     $resp['behind_lines'] = isset($_POST['behind_lines']) ? Uiform_Form_Helper::sanitizeInput($_POST['behind_lines']) : '';
     $resp['front_lines_st'] = isset($_POST['front_lines_st']) ? Uiform_Form_Helper::sanitizeInput($_POST['front_lines_st']) : '';
     $resp['front_lines'] = isset($_POST['front_lines']) ? Uiform_Form_Helper::sanitizeInput($_POST['front_lines']) : '';
     $resp['ca_txt_gen'] = $phrase;
     $captcha_options = Uiform_Form_Helper::base64url_encode(json_encode($resp));
     $resp2 = array();
     $resp2['rkver'] = $captcha_options;
     //return data to ajax callback
     header('Content-Type: application/json');
     echo json_encode($resp2);
     wp_die();
 }
 /**
  * Output the settings
  */
 public function output()
 {
     global $woocommerce, $woocommerce_settings, $current_section, $current_tab;
     if (!current_user_can('manage_woocommerce')) {
         wp_die(__('You do not have sufficient permissions to access this page.', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN));
     }
     do_action('woocommerce_mailpoet_settings_start');
     $mailpoet_settings = $this->get_settings();
     // Get current section
     $current_section = empty($_REQUEST['section']) ? 'general' : sanitize_text_field(urldecode($_REQUEST['section']));
     $current = $current_section ? '' : ' class="current"';
     // Creates each settings section.
     $mailpoet_section = apply_filters('woocommerce_mailpoet_settings_sections', array('general' => __('General', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN), 'lists' => __('Lists', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN)));
     foreach ($mailpoet_section as $section => $title) {
         $title = ucwords($title);
         $current = $section == $current_section ? ' class="current"' : '';
         $links[] = '<a href="' . add_query_arg('section', $section, admin_url('admin.php?page=woocommerce_settings&tab=mailpoet')) . '"' . $current . '>' . esc_html($title) . '</a>';
     }
     echo '<ul class="subsubsub"><li>' . implode('| </li><li>', $links) . '</li></ul><br class="clear" />';
     woocommerce_admin_fields($mailpoet_settings);
     if ($current_section == 'lists') {
         include_once MailPoet_WooCommerce_Add_on()->plugin_path() . '/includes/admin/settings/settings-newsletters.php';
         $mailpoet_list = mailpoet_lists();
         do_action('woocommerce_mailpoet_list_newsletters', $mailpoet_list);
     }
 }
Example #17
0
 public function activate()
 {
     if (!in_array('woocommerce/woocommerce.php', get_option('active_plugins')) || !defined('WC_VERSION') || !version_compare(WC_VERSION, '2.6', '>=')) {
         deactivate_plugins(plugin_basename(__FILE__));
         wp_die(sprintf(__('Для работы плагина eDostavka нужно установить %s! не ниже 2.6 версии'), '<a href="http://wordpress.org/extend/plugins/woocommerce/">WooCommerce</a>'));
     }
 }
Example #18
0
 protected function prepare()
 {
     include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
     try {
         $this->api = $api = Sputnik::get_plugin($this->id);
     } catch (Exception $e) {
         status_header(500);
         $this->header();
         echo '<p>' . $e->getMessage() . '</p>';
         $this->footer();
         return;
     }
     if (!Sputnik::is_purchased($this->api->slug)) {
         wp_redirect(Sputnik_Admin::build_url(array('buy' => $this->id)));
         die;
     }
     if (!current_user_can('install_plugins')) {
         wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'sputnik'));
     }
     check_admin_referer($this->nonce_prefix . $this->api->slug);
     include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
     $title = sprintf($this->title_format, $this->api->name . ' ' . $this->api->version);
     $nonce = $this->nonce_prefix . $this->id;
     $url = 'update.php?action=install-plugin&plugin=' . $this->id;
     if (isset($_GET['from'])) {
         $url .= '&from=' . urlencode(stripslashes($_GET['from']));
     }
     $type = 'web';
     //Install plugin type, From Web or an Upload.
     if ($this->api->is_theme) {
         $this->upgrader = new Sputnik_ThemeUpgrader(new Sputnik_View_Install_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
     } else {
         $this->upgrader = new Sputnik_Upgrader(new Sputnik_View_Install_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
     }
 }
Example #19
0
 static function Init()
 {
     global $submenu;
     if (!empty($submenu['wpfilebase_manage']) && is_array($submenu['wpfilebase_manage']) && (empty($_GET['page']) || $_GET['page'] !== 'wpfilebase_css')) {
         foreach (array_keys($submenu['wpfilebase_manage']) as $i) {
             if ($submenu['wpfilebase_manage'][$i][2] === 'wpfilebase_css') {
                 unset($submenu['wpfilebase_manage'][$i]);
                 break;
             }
         }
     }
     add_filter('mce_external_plugins', array(__CLASS__, 'McePlugins'));
     add_filter('mce_buttons', array(__CLASS__, 'MceButtons'));
     if (isset($_GET['wpfilebase-screen'])) {
         switch ($_GET['wpfilebase-screen']) {
             case 'editor-plugin':
                 require_once WPFB_PLUGIN_ROOT . 'screens/editor-plugin.php';
                 exit;
             case 'tpl-preview':
                 require_once WPFB_PLUGIN_ROOT . 'screens/tpl-preview.php';
                 exit;
         }
         wp_die('Unknown screen ' . esc_html($_GET['wpfilebase-screen']) . '!');
     }
 }
function smamo_instagram()
{
    // Klargør svar
    $response = array();
    $num = isset($_POST['num']) ? 4 * wp_strip_all_tags($_POST['num']) : 4;
    // vi skal bruge et hashtag, ellers die();
    if (!isset($_POST['hash'])) {
        $response['code'] = '400';
        $response['error'] = 'No hashtag received';
        wp_die(json_encode($response));
    }
    // Indstil $tag
    $tag = wp_strip_all_tags($_POST['hash']);
    // Inkluder instagram class
    require get_template_directory() . '/functions/instagram/instagram.class.php';
    // Opret ny instance
    $instagram = new Instagram(array('apiKey' => 'dd36cc7a7be445c8a00d9f383e49f8c8', 'apiSecret' => 'e750735ffba74f8a8ed753a33c7351da', 'apiCallback' => 'http://faaborg-gym.dk'));
    $response['images'] = array();
    $inst_obj = $instagram->getTagMedia($tag, $num);
    $next_page = $instagram->pagination($inst_obj);
    $response['next'] = $next_page;
    foreach ($inst_obj->data as $key => $val) {
        $response['images'][] = $val;
    }
    wp_die(json_encode($response));
}
    function my_plugin_options()
    {
        if (!current_user_can('manage_options')) {
            wp_die(__('You do not have sufficient permissions to access this page.'));
        }
        ?>
				<center>
            <h1>Add Menu</h1>
                <label for="name">Add a New Menu to the site: </label><br/>
                <input type="text" id="name" name="name" placeholder="Enter Menu Name"/>
                <div id="myDiv"><h2>Let AJAX change this text</h2></div>
                <button class="btn btn-info" onclick="anthonyportfolioajax()">Add New Menu</button>
            <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
            <script>
                function anthonyportfolioajax()
                {
                    var name = $('#name').val();
                    var data = {
							'action': 'process_add',
							'name': name
                            };
                    $.post( ajaxurl, data, function(response ){
                            var mes = "Menu has been added Successfully";
                            $("#myDiv").text( mes );
                            var name = $('#name').val();
                            alert(ajaxurl);
                            console.log(response);
                        }
                    );
                }
            </script>
        </center>
				<?php 
    }
    /**
     * Add WordPress standard form for options page
     * @return string
     */
    public function italystrap_callback_function()
    {
        if (!current_user_can($this->capability)) {
            wp_die(__('You do not have sufficient permissions to access this page.'));
        }
        ?>

				<div class="wrap">
					<h2>
						<span class="dashicons dashicons-admin-settings" style="font-size:32px;margin-right:15px"></span> ItalyStrap panel
					</h2>
						<?php 
        settings_errors();
        ?>

					<form action='options.php' method='post'>
						
						<?php 
        settings_fields('italystrap_theme_options_group');
        do_settings_sections('italystrap_theme_options_group');
        submit_button();
        ?>
						
					</form>
				</div>

			<?php 
    }
function wptreehouse_badges_options_page()
{
    if (!current_user_can('manage_options')) {
        wp_die('You do not have sufficient permissions to access this page.');
    }
    global $plugin_url;
    global $options;
    global $display_json;
    if (isset($_POST['wptreehouse_form_submitted'])) {
        $hidden_field = esc_html($_POST['wptreehouse_form_submitted']);
        if ($hidden_field == 'Y') {
            $wptreehouse_username = esc_html($_POST['wptreehouse_username']);
            $wptreehouse_profile = wptreehouse_badges_get_profile($wptreehouse_username);
            $options['wptreehouse_username'] = $wptreehouse_username;
            $options['wptreehouse_profile'] = $wptreehouse_profile;
            $options['last_updated'] = time();
            update_option('wptreehouse_badges', $options);
        }
    }
    $options = get_option('wptreehouse_badges');
    if ($options != '') {
        $wptreehouse_username = $options['wptreehouse_username'];
        $wptreehouse_profile = $options['wptreehouse_profile'];
    }
    require 'inc/options-page-wrapper.php';
}
Example #24
0
 /**
  * Don't use this. Use ::get_instance() instead.
  */
 public function __construct()
 {
     if (!self::$instance) {
         $message = '<code>' . __CLASS__ . '</code> is a singleton.<br/> Please get an instantiate it with <code>' . __CLASS__ . '::get_instance();</code>';
         wp_die($message);
     }
 }
 public static function bulk_edit_options()
 {
     if (!current_user_can('manage_options')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     if (array_key_exists("id", $_REQUEST)) {
         $id = $_REQUEST["id"];
         if (array_key_exists("update", $_POST)) {
             self::$update = $_POST["update"] === "TRUE";
             echo "has been updated!";
         }
         require_once "products/" . $_REQUEST["name"] . ".php";
         global $calc_rules;
         self::$calc_rules = $calc_rules;
         if (self::$calc_rules["id"] == $id) {
             $product = get_product($id);
             if ($product->product_type == 'variable') {
                 self::getProduct($product);
             } else {
                 echo "product is not a variable product";
             }
         } else {
             echo "wrong product id. given: " . $id . ". should be: " . self::$calc_rules["id"];
         }
     } else {
         echo "no ID specified";
     }
 }
Example #26
0
function filebrowser_options_load()
{
    global $filebrowser_message, $gotofolder;
    $gotofolder = str_replace('\\', '/', ABSPATH);
    if (!current_user_can(10)) {
        wp_die('No rights');
    }
    //Css for Admin Section
    wp_enqueue_style('FileBrowser', plugins_url('/css/options.css', __FILE__), '', FILEBROWSER_VERSION, 'screen');
    if ($_GET['action'] == 'edit') {
        wp_enqueue_script('CodeMirror', plugins_url('/codemirror/js/codemirror.js', __FILE__), '', '0.70', false);
    }
    if ($_POST['action2'] != '-1') {
        $action = $_POST['action2'];
    }
    if ($_POST['action'] != '-1') {
        $action = $_POST['action'];
    }
    if (!empty($_GET['action']) and empty($action)) {
        $action = $_GET['action'];
    }
    //For change folder by hand
    if ($_POST['doactiongo'] == __('Go', 'filebrowser')) {
        if (@is_dir(str_replace('\\', '/', realpath($_POST['root'] . $_POST['newfolder'])))) {
            $gotofolder = str_replace('\\', '/', realpath($_POST['root'] . $_POST['newfolder']));
        } else {
            $gotofolder = $_POST['oldusedfolder'];
            $filebrowser_message = __('Could not jump to folder.', 'filebrowser');
        }
    }
    //For save Options
    require_once plugin_dir_path(__FILE__) . 'options-save.php';
}
 /**
  * Renders option page
  * @return mixed
  */
 public function op_shorcode_settings_page()
 {
     if (!current_user_can('manage_options')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     include_once 'partials/show/settings-page.php';
 }
Example #28
-1
 /**
  * Deactivates our plugin if anything goes wrong. Also, removes the
  * "Plugin activated" message, if we don't pass requriments check.
  */
 public static function pluginDeactivate($message)
 {
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     deactivate_plugins('comment-attachment/comment-attachment.php');
     unset($_GET['activate']);
     wp_die($message);
 }
function ajax_contact_form()
{
    $response = array();
    $navn = isset($_POST['navn']) ? wp_strip_all_tags($_POST['navn']) : false;
    $email = isset($_POST['email']) ? wp_strip_all_tags($_POST['email']) : false;
    $firma = isset($_POST['firma']) ? wp_strip_all_tags($_POST['firma']) : false;
    $telefon = isset($_POST['telefon']) ? wp_strip_all_tags($_POST['telefon']) : false;
    $about = isset($_POST['about']) ? wp_strip_all_tags($_POST['about']) : false;
    $kommentar = isset($_POST['kommentar']) ? esc_textarea($_POST['kommentar']) : false;
    if (!$navn) {
        $response['error'] = 'Indtast et navn';
    } else {
        if (!$email) {
            $response['error'] = 'Indtast en email';
        }
    }
    if (!isset($response['error'])) {
        $post_vars = array('post_title' => $navn . ' [' . $email . ']', 'post_status' => 'publish', 'post_type' => 'form');
        $response['post_id'] = wp_insert_post($post_vars, true);
        if (is_wp_error($response['post_id'])) {
            $response['error'] = $return->get_error_message();
        }
    }
    if (!isset($response['error'])) {
        update_post_meta($response['post_id'], 'form_navn', $navn);
        update_post_meta($response['post_id'], 'form_email', $email);
        update_post_meta($response['post_id'], 'form_firma', $firma);
        update_post_meta($response['post_id'], 'form_telefon', $telefon);
        update_post_meta($response['post_id'], 'form_about', $about);
        update_post_meta($response['post_id'], 'form_kommentar', $kommentar);
        $response['success'] = '<article><h2>Tak for din henvendelse</h2><p>Vi vil besvare den hurtigst muligt.</p><article>';
        sendEmail(get_theme_mod('info_name'), get_theme_mod('info_email'), get_theme_mod('info_email'), 'Ny henvendelse fra ' . $navn, $kommentar);
    }
    wp_die(json_encode($response));
}
Example #30
-1
 static function InitClass()
 {
     wp_enqueue_style(WPFB . '-admin', WPFB_PLUGIN_URI . 'css/admin.css', array(), WPFB_VERSION, 'all');
     wp_register_script('jquery-deserialize', WPFB_PLUGIN_URI . 'extras/jquery/jquery.deserialize.js', array('jquery'), WPFB_VERSION);
     if (isset($_GET['page'])) {
         $page = $_GET['page'];
         if ($page == 'wpfilebase_files') {
             wp_enqueue_script('postbox');
             wp_enqueue_style('dashboard');
         } elseif ($page == 'wpfilebase' && isset($_GET['action']) && $_GET['action'] == 'sync') {
             do_action('wpfilebase_sync');
             wp_die("Filebase synced.");
         }
     }
     add_action('wp_dashboard_setup', array(__CLASS__, 'AdminDashboardSetup'));
     //wp_register_widget_control(WPFB_PLUGIN_NAME, "[DEPRECATED]".WPFB_PLUGIN_NAME .' '. __('File list',WPFB), array(__CLASS__, 'WidgetFileListControl'), array('description' => __('DEPRECATED', WPFB)));
     add_action('admin_print_scripts', array('WPFB_AdminLite', 'AdminPrintScripts'));
     self::CheckChangedVer();
     if (basename($_SERVER['PHP_SELF']) === "plugins.php") {
         if (isset($_GET['wpfb-uninstall']) && current_user_can('edit_files')) {
             update_option('wpfb_uninstall', !empty($_GET['wpfb-uninstall']) && $_GET['wpfb-uninstall'] != "0");
         }
         if (get_option('wpfb_uninstall')) {
             function wpfb_uninstall_warning()
             {
                 echo "\n\t\t\t\t<div id='wpfb-warning' class='updated fade'><p><strong>" . __('WP-Filebase will be uninstalled completely when deactivating the Plugin! All settings and File/Category Info will be deleted. Actual files in the upload directory will not be removed.') . ' <a href="' . add_query_arg('wpfb-uninstall', '0') . '">' . __('Cancel') . "</a></strong></p></div>\n\t\t\t\t";
             }
             add_action('admin_notices', 'wpfb_uninstall_warning');
         }
     }
 }