Example #1
1
function send_form_feedback()
{
    if ($_POST) {
        // Set wp_mail html content type
        add_filter('wp_mail_content_type', 'set_html_content_type');
        $name = isset($_POST['name']) ? $_POST['name'] : '';
        $email = isset($_POST['email']) ? $_POST['email'] : '';
        $phone = isset($_POST['phone']) ? $_POST['phone'] : '';
        $message = isset($_POST['message']) ? $_POST['message'] : '';
        $to = get_option('admin_email');
        $subject = 'Новое сообщение';
        $content = '<p><b>Имя:</b> ' . $name . '</p>';
        $content .= '<p><b>E-mail:</b> ' . $email . '</p>';
        $content .= '<p><b>Телефон:</b> ' . $phone . '</p>';
        $content .= '<p><b>Сообщение:</b></p>';
        $content .= '<p>' . $message . '</p>';
        $content .= '<br /><br />';
        $content .= 'Это сообщение отправлено с сайта <a href="' . get_site_url() . '">' . get_site_url() . '</a>';
        if (wp_mail($to, $subject, $content)) {
            $json = array('status' => 'success', 'message' => '<b>Поздравляем!</b><br />Сообщение успешно отправлено');
        } else {
            $json = array('status' => 'error', 'message' => '<b>Ошибка!</b><br />Попробуйте позже или свяжитесь с администрацией сайта');
        }
        // Reset wp_mail html content type
        remove_filter('wp_mail_content_type', 'set_html_content_type');
        die(json_encode($json));
    }
    die(json_encode(array('status' => 'error', 'message' => '<b>Что-то пошло не так!</b><br />Попробуйте позже или свяжитесь с администрацией сайта')));
}
	/**
	 * Update WordPress plugin list page.
	 *
	 * @param  object $transient
	 * @return object
	 */
	public static function update_plugins( $transient ) {
		$extensions = Ai1wm_Extensions::get();

		// Get current updates
		$updates = get_option( AI1WM_UPDATER, array() );

		// Get extension updates
		foreach ( $updates as $slug => $update ) {
			if ( isset( $extensions[ $slug ]) && ( $extension = $extensions[ $slug ] ) ) {
				if ( get_option( $extension['key'] ) ) {
					if ( version_compare( $extension['version'], $update['version'], '<' ) ) {

						// Get Site URL
						$url = urlencode( get_site_url() );

						// Get Purchase ID
						$key = get_option( $extension['key'] );

						// Set plugin details
						$transient->response[ $extension['basename'] ] = (object) array(
							'slug'        => $slug,
							'new_version' => $update['version'],
							'url'         => $update['homepage'],
							'plugin'      => $extension['basename'],
							'package'     => sprintf( '%s/%s?siteurl=%s', $update['download_link'], $key, $url ),
						);
					}
				}
			}
		}

		return $transient;
	}
function CheckLoginCookie()
{
    global $wpdb, $ewd_feup_user_table_name;
    $LoginTime = get_option("EWD_FEUP_Login_Time");
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $CookieName = "EWD_FEUP_Login" . "%" . sha1(md5(get_site_url() . $Salt));
    $cookie_name_url_encoded = urlencode($CookieName);
    $Cookie = null;
    if (isset($_COOKIE[$CookieName])) {
        $Cookie = $_COOKIE[$CookieName];
    }
    if (isset($_COOKIE[$cookie_name_url_encoded])) {
        $Cookie = $_COOKIE[$cookie_name_url_encoded];
    }
    $Username = substr($Cookie, 0, strpos($Cookie, "%"));
    $TimeStamp = substr($Cookie, strpos($Cookie, "%") + 1, strrpos($Cookie, "%") - strpos($Cookie, "%"));
    $SecCheck = substr($Cookie, strrpos($Cookie, "%") + 1);
    $UserAgent = $_SERVER['HTTP_USER_AGENT'];
    if (isset($_COOKIE[$CookieName]) || isset($_COOKIE[$cookie_name_url_encoded]) and $TimeStamp < time() + $LoginTime * 60) {
        $UserDB = $wpdb->get_row($wpdb->prepare("SELECT User_Sessioncheck , User_Password FROM {$ewd_feup_user_table_name} WHERE Username ='******'", $Username));
        $DBSeccheck = $UserDB->User_Sessioncheck;
        if (strcmp(sha1($SecCheck . $UserAgent), $DBSeccheck) === 0) {
            $User = array('Username' => $Username, 'User_Password' => $UserDB->User_Password);
            return $User;
        } else {
            return false;
        }
    }
    return false;
}
Example #4
0
 function avia_menu_item_filter($item)
 {
     if (isset($item->url) && strpos($item->url, '#DOMAIN') === 0) {
         $item->url = str_replace("#DOMAIN", get_site_url(), $item->url);
     }
     return $item;
 }
Example #5
0
/** Setup database and sample data */
function flipping_team_install()
{
    global $wpdb;
    $table_name = $wpdb->prefix . "team";
    if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
        $sql = "CREATE TABLE " . $table_name . " (\n\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\ttime bigint(11) DEFAULT '0' NOT NULL,\n\t\t\tname tinytext NOT NULL,\n\t\t\turl VARCHAR(200) NOT NULL,\n\t\t\timageloc VARCHAR(300) NOT NULL,\n\t\t\tinfo text NOT NULL,\n\t\t\tUNIQUE KEY id (id)\n\t\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        add_option("flipping_team_db_version", $flipping_team_db_version);
        $table_name = $wpdb->prefix . "team";
        $name = "Abhishek Gupta";
        $website = "http://abhishek.cc";
        $info = "Student at IIT Delhi. More about on his website abhishek.cc or his startup zumbl.com .";
        $imageloc = get_site_url() . "/wp-content/plugins/flipping-team/images/images.jpeg";
        $rows_affected = $wpdb->insert($table_name, array('time' => current_time('mysql'), 'name' => $name, 'url' => $website, 'imageloc' => $imageloc, 'info' => $info));
        $table_name = $wpdb->prefix . "team";
        $name = "Scii";
        $website = "http://scil.coop";
        $info = "More about on his website.";
        $imageloc = get_site_url() . "/wp-content/plugins/flipping-team/images/images.jpeg";
        $rows_affected = $wpdb->insert($table_name, array('time' => current_time('mysql'), 'name' => $name, 'url' => $website, 'imageloc' => $imageloc, 'info' => $info));
    }
    $installed_ver = get_option("flipping_team_db_version");
    if ($installed_ver != $jal_db_version) {
        $sql = "CREATE TABLE " . $table_name . " (\n\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\ttime bigint(11) DEFAULT '0' NOT NULL,\n\t\t\tname tinytext NOT NULL,\n\t\t\turl VARCHAR(200) NOT NULL,\n\t\t\timageloc VARCHAR(300) NOT NULL,\n\t\t\tinfo text NOT NULL,\n\t\t\tUNIQUE KEY id (id)\n\t\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        update_option("flipping_team_db_version", $flipping_team_db_version);
    }
}
Example #6
0
 /**
  *
  */
 public function activate()
 {
     $params = array();
     $params['username'] = vc_post_param('username');
     $params['version'] = WPB_VC_VERSION;
     $params['key'] = vc_post_param('key');
     $params['api_key'] = vc_post_param('api_key');
     $params['url'] = get_site_url();
     $params['ip'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
     $params['dkey'] = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
     $string = 'activatelicense?';
     $request_url = self::getWpbControlUrl(array($string, http_build_query($params, '', '&')));
     $response = wp_remote_get($request_url, array('timeout' => 300));
     if (is_wp_error($response)) {
         echo json_encode(array('result' => false));
         die;
     }
     $result = json_decode($response['body']);
     if (!is_object($result)) {
         echo json_encode(array('result' => false));
         die;
     }
     if ((bool) $result->result === true || (int) $result->code === 401 && isset($result->deactivation_key)) {
         $this->setDeactivation(isset($result->code) && (int) $result->code === 401 ? $result->deactivation_key : $params['dkey']);
         vc_settings()->set('envato_username', $params['username']);
         vc_settings()->set('envato_api_key', $params['api_key']);
         vc_settings()->set('js_composer_purchase_code', $params['key']);
         echo json_encode(array('result' => true));
         die;
     }
     echo $response['body'];
     die;
 }
Example #7
0
function sf_red_validate($in)
{
    $out = array();
    $url = get_site_url();
    $in = json_decode($in, true);
    if (is_array($in)) {
        for ($i = 0; $i < count($in); $i++) {
            if (is_array($in[$i]) && $in[$i][0]) {
                $tmp = strpos($in[$i][0], substr(strstr($url, '//'), 2));
                if ($tmp !== false) {
                    $in[$i][0] = substr($in[$i][0], $tmp + strlen(strstr($url, '//')) - 2);
                }
                if (substr($in[$i][0], 0, 1) != '/') {
                    $in[$i][0] = '/' . $in[$i][0];
                }
                $tmp = strpos($in[$i][1], '//');
                if ($tmp === false) {
                    $in[$i][1] = $url . (strpos($in[$i][1], '/') === 0 ? '' : '/') . $in[$i][1];
                } else {
                    if ($tmp === 0) {
                        $in[$i][1] = 'http:' . $in[$i][1];
                    }
                }
                if ($in[$i][1] == $url . '/') {
                    $in[$i][1] = $url;
                }
                $out[] = $in[$i];
            }
        }
    }
    return $out;
}
 public function search($query)
 {
     if (function_exists('is_main_query') && !$query->is_main_query()) {
         return $query;
     }
     if (is_search() && !is_admin() && $this->algolia_registry->validCredential && isset($_GET['instant']) === false) {
         if ($this->algolia_registry->instant) {
             $url = get_site_url() . '/?instant=1&s=' . $query->query['s'] . '#q=' . $query->query['s'] . '&page=0&refinements=%5B%5D&numerics_refinements=%7B%7D&index_name=%22' . $this->algolia_registry->index_name . 'all%22';
             header('Location: ' . $url);
             die;
         }
         $algolia_query = get_search_query(false);
         $options = array('hitsPerPage' => $this->algolia_registry->number_by_page, 'page' => get_query_var('paged') ? get_query_var('paged') - 1 : 0);
         $algolia_helper = new \Algolia\Core\AlgoliaHelper($this->algolia_registry->app_id, $this->algolia_registry->search_key, $this->algolia_registry->admin_key);
         $results = $algolia_helper->search($algolia_query, $options, $this->algolia_registry->index_name . 'all');
         foreach ($results['hits'] as $result) {
             $this->ids[] = $result['objectID'];
         }
         $this->num_pages = $results['nbPages'];
         $this->total_result_count = $results['nbHits'];
         $this->page = $results['page'];
         $query->query = array();
         set_query_var('post__in', $this->ids);
         set_query_var('post_type', null);
         set_query_var('s', null);
         set_query_var('paged', null);
         return $query;
     }
     return $query;
 }
function wfap_get_access_token()
{
    if (isset($_REQUEST['code'])) {
        $code = $_REQUEST['code'];
        $id = get_option('wfap_app_id');
        $sec = get_option('wfap_sec_id');
        $page_url = get_site_url();
        $auth_url = 'https://graph.facebook.com/oauth/access_token?client_id=' . $id . '&client_secret=' . $sec . '&redirect_uri=' . $page_url . '&code=' . $code;
        //echo $auth_url;exit;
        //$accesscode = file_get_contents($auth_url);
        $curl_handle = curl_init();
        curl_setopt($curl_handle, CURLOPT_URL, $auth_url);
        curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
        curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl_handle, CURLOPT_USERAGENT, 'fb_auto');
        $query = curl_exec($curl_handle);
        curl_close($curl_handle);
        $allval = array();
        $token = array();
        $allval = explode("=", $query);
        $token = explode("&", $allval[1]);
        $message = "Thank you for authenticate";
        if ($token != '') {
            update_option('wfap_user_tkn', $token[0]);
        }
        //echo $query;exit;
        $location = admin_url('admin.php?page=wp-facebook-auto-publish/wp-fap-gui.php&msg=' . $message);
        wp_redirect($location);
        exit;
    }
}
 function zero_scripts()
 {
     if (!is_admin()) {
         //Call Modernizr
         wp_register_script('modernizr', get_template_directory_uri() . '/js/libs/modernizr.dev.js', array(), null, false);
         wp_enqueue_script('modernizr');
         //Call JQuery
         wp_deregister_script('jquery');
         wp_register_script('jquery', '/wp-includes/js/jquery/jquery.js', '', '', true);
         wp_enqueue_script('jquery');
         if (is_front_page() || is_page_template('new-story-page.php')) {
             wp_register_script('slider_js', get_template_directory_uri() . '/js/libs/slider.min.js', array('jquery'), null, true);
             wp_enqueue_script('slider_js');
         }
         if (is_page(11) || is_child(11)) {
             wp_register_script('gallery_js', get_template_directory_uri() . '/js/libs/gallery.js', array('jquery'), null, true);
             wp_enqueue_script('gallery_js');
         }
         //Call Framework js file
         wp_register_script('main_js', get_template_directory_uri() . '/js/build/concat.js', array('jquery'), '', true);
         wp_enqueue_script('main_js');
     }
     // Setting the site URL as a global variable
     // You can use it to access the template URL in the mainJSfile
     $site_parameters = array('site_url' => get_site_url(), 'theme_directory' => get_template_directory_uri());
     wp_localize_script('main_js', 'SiteParameters', $site_parameters);
 }
 public function __construct($pluginMainFile)
 {
     $this->_wpUrl = get_site_url();
     $this->_wpUrl = $this->makeUniversalLink($this->_wpUrl);
     $this->_wpPluginsUrl = plugins_url('/');
     $this->_wpPluginsUrl = $this->makeUniversalLink($this->_wpPluginsUrl);
     $this->_pluginDirName = plugin_basename(dirname($pluginMainFile)) . '/';
     $this->_pluginMainFile = $pluginMainFile;
     $this->_pluginPath = plugin_dir_path($pluginMainFile);
     $this->_pluginUrl = plugins_url('/', $pluginMainFile);
     $this->_pluginUrl = $this->makeUniversalLink($this->_pluginUrl);
     $this->_pluginCachePath = $this->_pluginPath . 'cache/';
     $this->_pluginCacheUrl = $this->_pluginUrl . 'cache/';
     $this->_pluginStaticPath = $this->_pluginPath . 'static/';
     $this->_pluginStaticUrl = $this->_pluginUrl . 'static/';
     $this->_pluginCssPath = $this->_pluginStaticPath . 'styles/';
     $this->_pluginCssUrl = $this->_pluginStaticUrl . 'styles/';
     $this->_pluginImagesPath = $this->_pluginStaticPath . 'images/';
     $this->_pluginImagesUrl = $this->_pluginStaticUrl . 'images/';
     $this->_pluginJsPath = $this->_pluginStaticPath . 'js/';
     $this->_pluginJsUrl = $this->_pluginStaticUrl . 'js/';
     $this->_pluginTemplatePath = $this->_pluginPath . 'templates/';
     $this->_pluginTemplateUrl = $this->_pluginUrl . 'templates/';
     $this->_pluginLanguagesPath = $this->_pluginDirName . 'languages/';
     $this->onInit();
 }
Example #12
0
function activity_admin_post_category_check($post_id, $post, $update)
{
    if (is_admin()) {
        if (is_plugin_active('activity/activity.php')) {
            $post_cat = wp_get_post_categories($post_id);
            if (empty($post_cat)) {
                return;
            } else {
                $activity_cat = intval(get_option('activity_category'));
                $is_post_activity = in_array($activity_cat, $post_cat);
                if ($is_post_activity) {
                    if (strpos($_SERVER['REQUEST_URI'], '/wp-admin/admin.php?page=activity_admin') === false) {
                        $post_cat = array_diff($post_cat, array($activity_cat));
                        if (empty($post_cat)) {
                            $post_cat = array(1);
                        }
                        $post_data = array('ID' => $post_id, 'post_category' => $post_cat);
                        $post_update = wp_update_post($post_data);
                        header('Location: ' . get_site_url() . '/wp-admin/admin.php?page=activity_admin&action=error_add_activity');
                        exit;
                    }
                }
            }
        }
    }
}
 public function __construct($parent)
 {
     //Call parent constructor
     parent::__construct($parent);
     //Get the textdomain from the Helper class
     $this->l10n_domain = ACF_Location_Field_Helper::L10N_DOMAIN;
     //Base directory of this field
     $this->base_dir = rtrim(dirname(realpath(__FILE__)), DIRECTORY_SEPARATOR);
     //Build the base relative uri by searching backwards until we encounter the wordpress ABSPATH
     //This may not work if the $base_dir contains a symlink outside of the WordPress ABSPATH
     $root = array_pop(explode(DIRECTORY_SEPARATOR, rtrim(realpath(ABSPATH), DIRECTORY_SEPARATOR)));
     $path_parts = explode(DIRECTORY_SEPARATOR, $this->base_dir);
     $parts = array();
     while ($part = array_pop($path_parts)) {
         if ($part == $root) {
             break;
         }
         array_unshift($parts, $part);
     }
     $this->base_uri_rel = '/' . implode('/', $parts);
     $this->base_uri_abs = get_site_url(null, $this->base_uri_rel);
     // set name / title
     $this->name = 'location-field';
     // variable name (no spaces / special characters / etc)
     $this->title = __('Location', $this->l10n_domain);
     // field label (Displayed in edit screens)
     add_action('admin_print_scripts', array(&$this, 'admin_print_scripts'), 12, 0);
     add_action('admin_print_styles', array(&$this, 'admin_print_styles'), 12, 0);
 }
/**
 * Email Preview Template Tags
 *
 * @since 1.0
 * @param string $message Email message with template tags
 * @return string $message Fully formatted message
 */
function edd_email_preview_template_tags($message)
{
    $download_list = '<ul>';
    $download_list .= '<li>' . __('Sample Product Title', 'easy-digital-downloads') . '<br />';
    $download_list .= '<div>';
    $download_list .= '<a href="#">' . __('Sample Download File Name', 'easy-digital-downloads') . '</a> - <small>' . __('Optional notes about this download.', 'easy-digital-downloads') . '</small>';
    $download_list .= '</div>';
    $download_list .= '</li>';
    $download_list .= '</ul>';
    $file_urls = esc_html(trailingslashit(get_site_url()) . 'test.zip?test=key&key=123');
    $price = edd_currency_filter(edd_format_amount(10.5));
    $gateway = 'PayPal';
    $receipt_id = strtolower(md5(uniqid()));
    $notes = __('These are some sample notes added to a product.', 'easy-digital-downloads');
    $tax = edd_currency_filter(edd_format_amount(1.0));
    $sub_total = edd_currency_filter(edd_format_amount(9.5));
    $payment_id = rand(1, 100);
    $user = wp_get_current_user();
    $message = str_replace('{download_list}', $download_list, $message);
    $message = str_replace('{file_urls}', $file_urls, $message);
    $message = str_replace('{name}', $user->display_name, $message);
    $message = str_replace('{fullname}', $user->display_name, $message);
    $message = str_replace('{username}', $user->user_login, $message);
    $message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message);
    $message = str_replace('{subtotal}', $sub_total, $message);
    $message = str_replace('{tax}', $tax, $message);
    $message = str_replace('{price}', $price, $message);
    $message = str_replace('{receipt_id}', $receipt_id, $message);
    $message = str_replace('{payment_method}', $gateway, $message);
    $message = str_replace('{sitename}', get_bloginfo('name'), $message);
    $message = str_replace('{product_notes}', $notes, $message);
    $message = str_replace('{payment_id}', $payment_id, $message);
    $message = str_replace('{receipt_link}', sprintf(__('%1$sView it in your browser.%2$s', 'easy-digital-downloads'), '<a href="' . esc_url(add_query_arg(array('payment_key' => $receipt_id, 'edd_action' => 'view_receipt'), home_url())) . '">', '</a>'), $message);
    return wpautop(apply_filters('edd_email_preview_template_tags', $message));
}
Example #15
0
function get_site_subfolder()
{
    $url_root = get_site_url_root();
    $site_address = get_site_url();
    $subfolder = str_replace($url_root, '', $site_address);
    return $subfolder;
}
Example #16
0
 function test_bp_core_ajax_url()
 {
     $forced = force_ssl_admin();
     // (1) HTTPS off
     force_ssl_admin(false);
     $_SERVER['HTTPS'] = 'off';
     // (1a) Front-end
     $this->go_to('/');
     $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http'));
     // (1b) Dashboard
     $this->go_to('/wp-admin');
     $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http'));
     // (2) FORCE_SSL_ADMIN
     force_ssl_admin(true);
     // (2a) Front-end
     $this->go_to('/');
     $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http'));
     // (2b) Dashboard
     $this->go_to('/wp-admin');
     $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'https'));
     force_ssl_admin($forced);
     // (3) Multisite, root blog other than 1
     if (is_multisite()) {
         $original_root_blog = bp_get_root_blog_id();
         $blog_id = $this->factory->blog->create(array('path' => '/path' . rand() . time() . '/'));
         buddypress()->root_blog_id = $blog_id;
         $blog_url = get_blog_option($blog_id, 'siteurl');
         $this->go_to(trailingslashit($blog_url));
         buddypress()->root_blog_id = $original_root_blog;
         $ajax_url = bp_core_ajax_url();
         $this->go_to('/');
         $this->assertEquals($blog_url . '/wp-admin/admin-ajax.php', $ajax_url);
     }
 }
Example #17
0
function Insert_Logout($atts)
{
    // Include the required global variables, and create a few new ones
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $CookieName = urlencode("EWD_FEUP_Login" . "%" . sha1(md5(get_site_url() . $Salt)));
    $feup_Label_Successful_Logout_Message = get_option("EWD_FEUP_Label_Successful_Logout_Message");
    if ($feup_Label_Successful_Logout_Message == "") {
        $feup_Label_Successful_Logout_Message = __("You have been successfully logged out.", "EWD_FEUP");
    }
    $ReturnString = "";
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('no_message' => '', 'redirect_page' => '#', 'no_redirect' => 'No', 'submit_text' => 'Logout'), $atts));
    if ($no_redirect != "Yes" and isset($_COOKIE[$CookieName])) {
        $redirect_page = get_the_permalink();
    }
    setcookie($CookieName, "", time() - 3600, "/");
    $_COOKIE[urldecode($CookieName)] = "";
    if ($redirect_page != "#") {
        FEUPRedirect($redirect_page);
    }
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    $ReturnString .= "<div class='feup-information-div'>";
    $ReturnString .= $feup_Label_Successful_Logout_Message;
    $ReturnString .= "</div>";
    if ($no_message != "Yes") {
        return $ReturnString;
    }
}
Example #18
0
 function fix_permalink($url, $post)
 {
     if (is_sp_post_type(get_post_type($post)) && 1 !== get_current_blog_id()) {
         return str_replace(get_site_url() . '/blog', get_site_url(), $url);
     }
     return $url;
 }
Example #19
0
 private function send_new_login_url($url)
 {
     if (ITSEC_Core::doing_data_upgrade()) {
         // Do not send emails when upgrading data. This prevents spamming users with notifications just because the
         // data was ported from an old version to a new version.
         return;
     }
     $message = '<p>' . __('Dear Site Admin,', 'better-wp-security') . "</p>\n";
     /* translators: 1: Site name, 2: Site address, 3: New login address */
     $message .= '<p>' . sprintf(__('The login address for %1$s (<code>%2$s</code>) has changed. The new login address is <code>%3$s</code>. You will be unable to use the old login address.', 'better-wp-security'), get_bloginfo('name'), esc_url(get_site_url()), esc_url($url)) . "</p>\n";
     if (defined('ITSEC_DEBUG') && ITSEC_DEBUG === true) {
         $message .= '<p>Debug info (source page): ' . esc_url($_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]) . "</p>\n";
     }
     $message = "<html>\n{$message}</html>\n";
     //Setup the remainder of the email
     $recipients = ITSEC_Modules::get_setting('global', 'notification_email');
     $subject = sprintf(__('[%1$s] WordPress Login Address Changed', 'better-wp-security'), get_site_url());
     $subject = apply_filters('itsec_lockout_email_subject', $subject);
     $headers = 'From: ' . get_bloginfo('name') . ' <' . get_option('admin_email') . '>' . "\r\n";
     //Use HTML Content type
     add_filter('wp_mail_content_type', array($this, 'get_html_content_type'));
     //Send emails to all recipients
     foreach ($recipients as $recipient) {
         $recipient = trim($recipient);
         if (is_email($recipient)) {
             wp_mail($recipient, $subject, $message, $headers);
         }
     }
     //Remove HTML Content type
     remove_filter('wp_mail_content_type', array($this, 'get_html_content_type'));
 }
 public static function load()
 {
     // Populate siteurl for later usage
     self::$siteurl = get_site_url();
     /**
      * Small optimisation:
      * WP_CONTENT_URL is used to move wp-content away from WordPress core
      * If wp-content is moved away wp-content urls are automatically relative
      * And we don't need to do anything
      * Also don't do this if https-domain-alias in in use because overlapping functionality
      */
     if (!defined('HTTPS_DOMAIN_ALIAS_FRONTEND_URL') && defined('WP_CONTENT_URL') && substr(WP_CONTENT_URL, 0, 1) != "/") {
         // Makes post content url relative
         add_filter('image_send_to_editor', array(__CLASS__, 'image_url_filter'), 10, 9);
         add_filter('media_send_to_editor', array(__CLASS__, 'media_url_filter'), 10, 3);
         // Change urls in wp-admin
         add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue_link_adder_js_fix'), 10, 1);
     }
     // When using feeds like rss the content should have absolute urls
     // These are quite easy to generate afterwards inside html content
     add_filter('the_content_feed', array(__CLASS__, 'content_return_absolute_url_filter'), 10, 1);
     /**
      * Check post content on save for absolute links
      * To activate this you need to filter: add_filter('wpp_make_content_relative',__return_true);
      */
     if (apply_filters('wpp_make_post_content_relative', false)) {
         add_filter('content_save_pre', array(__CLASS__, 'content_url_filter'), 10, 1);
     }
 }
    public function widget($args, $instance)
    {
        //$title = apply_filters( 'widget_title', $instance['title'] );
        echo $args['before_widget'];
        /*if ( ! empty( $title ) )
        			echo '';//$args['before_title'] . $title . $args['after_title'];
        		*/
        printf('<p class="contact_us_detail"><a href="%s" title="Mortgagehouse"><img src="%s" alt="Add image alt tag"></a></p>', get_site_url(), KSTHEME_IMG_DIR . "/Mortgagehouse_logo.png");
        // This is where you run the code and display the output
        echo '<p class="company-intro">With over 15 years’ experience in banking and finances, our management team has a complete understanding of the best bank products and processes available on the market; therefore we are able to provide a bespoke package which is tailored on a case by case basis.
			Serving both private and business communities within the UAE with a dynamic approach, Mortgage House has a wealth of resourceful advice plans that guarantees peace of mind for first time buyers and investors alike.<p>';
        echo '<ul class="contact-info-details">';
        printf('<li><i class="fa fa-home fa-lg"></i> %s</li>', 'Opposite Emirates Towers, Dubai');
        printf('<li><i class="fa fa-phone-square fa-lg"></i> %s</li>', '+971 43 550 666');
        printf('<li><i class="fa fa-envelope fa-lg"></i> <a href="%s">%s</a></li>', 'mailto:info@mortgagehouseuae.com', '*****@*****.**');
        printf('<li><i class="fa fa-clock-o fa-lg"></i> %s</li>', '9:00 am - 6:00 pm');
        printf('<li><i class="fa fa-globe fa-lg"></i> <a href="%s">%s</a></li>', 'http://www.mortgagehouseuae.com', 'www.mortgagehouseuae.com');
        echo '</ul>';
        $socials = array('facebook' => 'Facebook', 'twitter' => 'Twitter', 'google-plus' => 'Google+', 'linkedin' => 'LinkedIn', 'youtube' => 'YouTube');
        $social_output = '<ul class="contact-info-social">';
        foreach ($socials as $social_key => $social) {
            if (empty($instance[$social_key])) {
                continue;
            }
            $social_url = $instance[$social_key];
            $social_url = esc_url($social_url);
            $social_output .= '<li class="' . $social_key . '-bg"><a href="' . $social_url . '" target="_blank"><i class="fa fa-' . $social_key . ' fa-lg"></i></a></li>';
        }
        $social_output .= '</ul>';
        echo $social_output;
        echo $args['after_widget'];
    }
Example #22
0
function static_site_preview_url()
{
    $site_url = get_site_url();
    $parsed_url = parse_url($site_url);
    $preview_url = plugins_url('../output' . $parsed_url['path'], __FILE__);
    return $preview_url;
}
 /**
  * Start importer background process on production environment.
  */
 public function run()
 {
     // Get current deploy status (if any).
     $deploy_status = $this->api->get_deploy_status($this->batch->get_id());
     // Make sure background import for this job is not already running.
     if ($deploy_status > 0) {
         return;
     }
     // Inicate that background import is about to start.
     $this->api->set_deploy_status($this->batch->get_id(), 1);
     // Default site path.
     $site_path = '/';
     // Site path in multi-site setup.
     if (is_multisite()) {
         $site = get_blog_details();
         $site_path = $site->path;
     }
     // Trigger import script.
     $import_script = dirname(dirname(dirname(__FILE__))) . '/scripts/import-batch.php';
     $background_process = new Background_Process('php ' . $import_script . ' ' . ABSPATH . ' ' . get_site_url() . ' ' . $this->batch->get_id() . ' ' . $site_path . ' ' . $this->api->generate_import_key($this->batch));
     if (file_exists($import_script)) {
         $background_process->run();
     }
     if (!$background_process->get_pid()) {
         // Failed to start background import.
         $this->api->add_deploy_message($this->batch->get_id(), 'Batch import failed to start.', 'info');
         $this->api->set_deploy_status($this->batch->get_id(), 2);
     }
 }
Example #24
0
function CreateLoginCookie($Username, $Password)
{
    $LoginTime = get_option("EWD_FEUP_Login_Time");
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    //error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
    $CookieName = urlencode("EWD_FEUP_Login" . "%" . sha1(md5(get_site_url() . $Salt)));
    $CookieValue = $Username . "%" . time() . "%" . md5($_SERVER['REMOTE_ADDR'] . $Salt);
    $ExpirySecond = time() + (1 + $LoginTime) * 60;
    //$_POST['EWD_FEUP_Login_Cookie'] = $CookieValue;
    if (setcookie($CookieName, $CookieValue, $ExpirySecond, '/')) {
        $_COOKIE[urldecode($CookieName)] = $CookieValue;
        return true;
    } else {
        return false;
    }
    /*if (setcookie($CookieName, $CookieValue, $ExpirySecond, '/', $_SERVER["HTTP_HOST"])) {echo "Cookie Set<br>";}
    else {echo "Cookie Not Set<br>";}
    
    echo "Cookie Name: " . $CookieName . "<br>";
    echo "Cookie Value: " . $CookieValue . "<br>";
    echo "Login Time: " . $LoginTime . "<br>";
    echo "Expiry Second: " . $ExpirySecond . "<br>";
    echo "Domain: " . $_SERVER["HTTP_HOST"] . "<br>";
    
    return true;*/
}
Example #25
0
 function boas_scripts()
 {
     global $boas_opt;
     //Bootstrap Customized
     wp_enqueue_script('bootstarp', BOAS_ASSETS_URI . '/js/bootstrap.min.js', array('jquery'), BOAS_VAR, FALSE);
     //Icon front
     wp_enqueue_style('font-awesome', BOAS_ASSETS_URI . '/css/font-awesome.min.css', array(), BOAS_VAR);
     wp_enqueue_style('animate.css', BOAS_ASSETS_URI . '/animate.min.css', array(), BOAS_VAR);
     //Page Loader
     //wp_enqueue_style('pageloader-css', BOAS_ASSETS_URI . '/page-loader/css/introLoader.css', array(), '1.6.2');
     //wp_enqueue_script('pageloader-js', BOAS_ASSETS_URI . '/page-loader/jquery.introLoader.pack.min.js', array('jquery'), '1.6.2', FALSE);
     //Mobile MEnu
     wp_enqueue_style('mmenu-style', BOAS_ASSETS_URI . '/css/jquery.mmenu.all.css', array(), BOAS_VAR);
     wp_enqueue_script('mmenu-js', BOAS_ASSETS_URI . '/js/jquery.mmenu.min.all.js', array('jquery'), BOAS_VAR, FALSE);
     // wp_enqueue_script('tubeplayer', BOAS_ASSETS_URI . '/js/jQuery.tubeplayer.min.js', array('jquery'), '5.3.0', FALSE);
     wp_enqueue_style('flexslider-style', BOAS_ASSETS_URI . '/css/flexslider.css', array(), BOAS_VAR);
     wp_enqueue_script('flexslider', BOAS_ASSETS_URI . '/js/jquery.flexslider-min.js', array('jquery'), BOAS_VAR, FALSE);
     //Slider script
     if (!empty($boas_opt['content_load_animae'])) {
         wp_enqueue_script('wow', BOAS_ASSETS_URI . '/js/wow.min.js', array('jquery'), BOAS_VAR, FALSE);
     }
     //wp_enqueue_script('yt', BOAS_ASSETS_URI . '/js/vapi.js', array(''), BOAS_VAR, FALSE);
     //jquery magnific popup
     //wp_enqueue_style('magnific-popup', BOAS_ASSETS_URI . '/css/magnific-popup.css', array(), '1.0.0');
     //wp_enqueue_script('jquery.magnific-popup', BOAS_ASSETS_URI . '/js/jquery.magnific-popup.min.js', array('jquery'), '1.0.0', FALSE);
     wp_enqueue_script('sticky', BOAS_ASSETS_URI . '/js/jquery.stickyNavbar.min.js', array('jquery'), BOAS_VAR, TRUE);
     wp_enqueue_style('boas-style', BOAS_ASSETS_URI . '/css/boas.css', array(), BOAS_VAR);
     wp_enqueue_script('boas-script', BOAS_ASSETS_URI . '/js/boas-script.js', array('jquery'), BOAS_VAR, TRUE);
     wp_localize_script('boas-script', 'boas_obj', array('site_url' => get_site_url(), 'ajaxUrl' => admin_url('ajax.php'), 'mm_theme' => $boas_opt['mobile_menu_theme'], 'mm_show_logo' => $boas_opt['show_logo_sx'] ? TRUE : FALSE, 'mm_logo' => $boas_opt['logo_url_sx']['url']));
 }
 public static function init_fields()
 {
     if (self::$fields) {
         return;
     }
     self::$fields = apply_filters('submit_profile_form_fields', array('point' => array('name' => array('label' => __('Name', DLN_POINT_SLUG), 'type' => 'text', 'required' => true, 'placeholder' => __('Name is required', DLN_POINT_SLUG), 'priority' => 1), 'address' => array('label' => __('Address', DLN_POINT_SLUG), 'type' => 'text', 'required' => true, 'placeholder' => __('Address is required', DLN_POINT_SLUG), 'priority' => 2), 'city' => array('label' => __('City', DLN_POINT_SLUG), 'type' => 'text', 'required' => true, 'placeholder' => __('City is required', DLN_POINT_SLUG), 'priority' => 3), 'zipcode' => array('label' => __('Zip', DLN_POINT_SLUG), 'type' => 'text', 'required' => true, 'placeholder' => __('Zip is required', DLN_POINT_SLUG), 'priority' => 4), 'open_status' => array('label' => __('Open Status', DLN_POINT_SLUG), 'type' => 'radio', 'required' => true, 'default' => get_first_option(get_open_status()), 'options' => get_open_status(), 'priority' => 5)), 'online_infor' => array('website' => array('label' => __('Website address (URL)', DLN_POINT_SLUG), 'type' => 'text', 'required' => true, 'default' => get_site_url(), 'placeholder' => __('Website address is required', DLN_POINT_SLUG), 'priority' => 1), 'fb_address' => array('label' => __('Facebook address (URL)', DLN_POINT_SLUG), 'type' => 'text', 'required' => true, 'default' => 'http://www.facebook.com/pages/The-Pine-Box/299233916777600', 'placeholder' => __('Facebook address is required', DLN_POINT_SLUG), 'priority' => 2)), 'extra_fields' => array('price_range' => array('label' => __('Price range', DLN_POINT_SLUG), 'type' => 'radio', 'required' => true, 'default' => get_first_option(self::get_point_price_range()), 'options' => self::get_point_price_range(), 'priority' => 1), 'list_food' => array('label' => __('List of food', DLN_POINT_SLUG), 'type' => 'checkbox', 'options' => self::get_list_foods(), 'required' => true, 'priority' => 2), 'special_feature' => array('label' => __('Special feature', DLN_POINT_SLUG), 'type' => 'checkbox', 'options' => self::get_list_features(), 'required' => true, 'priority' => 3), 'suggestion_comment' => array('label' => __('Suggestion', DLN_POINT_SLUG), 'type' => 'textarea', 'required' => true, 'placeholder' => __('Please note: Any text you enter in this field will <b>only</b> be seen by NDD staff. ', DLN_POINT_SLUG), 'priority' => 5))));
 }
/**
 * Test whether force rewrite should be enabled or not.
 */
function wpseo_title_test()
{
    $options = get_option('wpseo_titles');
    $options['forcerewritetitle'] = false;
    $options['title_test'] = 1;
    update_option('wpseo_titles', $options);
    // Setting title_test to > 0 forces the plugin to output the title below through a filter in class-frontend.php.
    $expected_title = 'This is a Yoast Test Title';
    WPSEO_Utils::clear_cache();
    $args = array('user-agent' => sprintf('WordPress/%1$s; %2$s - Yoast', $GLOBALS['wp_version'], get_site_url()));
    $resp = wp_remote_get(get_bloginfo('url'), $args);
    if ($resp && !is_wp_error($resp) && (200 == $resp['response']['code'] && isset($resp['body']))) {
        $res = preg_match('`<title>([^<]+)</title>`im', $resp['body'], $matches);
        if ($res && strcmp($matches[1], $expected_title) !== 0) {
            $options['forcerewritetitle'] = true;
            $resp = wp_remote_get(get_bloginfo('url'), $args);
            $res = false;
            if ($resp && !is_wp_error($resp) && (200 == $resp['response']['code'] && isset($resp['body']))) {
                $res = preg_match('`/<title>([^>]+)</title>`im', $resp['body'], $matches);
            }
        }
        if (!$res || $matches[1] != $expected_title) {
            $options['forcerewritetitle'] = false;
        }
    } else {
        // If that dies, let's make sure the titles are correct and force the output.
        $options['forcerewritetitle'] = true;
    }
    $options['title_test'] = 0;
    update_option('wpseo_titles', $options);
}
Example #28
0
function subscriber_dashboard_redirect()
{
    if (current_user_can('subscriber')) {
        wp_redirect(get_site_url() . '/account/', $status);
        die;
    }
}
Example #29
0
 public function send_email_confirm()
 {
     global $wpdb;
     $datas = array($_POST["users"], $_POST["id"]);
     $res = $wpdb->get_results("select * from cjm_mail where id=" . $_POST["id"] . ";");
     $title = stripslashes($res[0]->title);
     $content = stripslashes($res[0]->content);
     foreach ($_POST["users"] as $key => $value) {
         $infos = explode("&", $value);
         $user = get_user_by("login", $infos[0]);
         $user_id = $user->ID;
         $user_infos = $wpdb->get_results("select nbplace,nbplace_enf,prix_total from cjm_reservation where id_participant={$user_id} and id_evenement={$infos['1']}");
         $tarif_adulte = get_post_meta($infos[1], "_tarif_adulte", true);
         $tarif_enf = get_post_meta($infos[1], "_tarif_enfant", true);
         $tarif_adh = get_post_meta($infos[1], "_tarif_adherent", true);
         $event_name = get_post_meta($infos[1], "_nom_voyage", true);
         $title = str_replace("%prix_total%", $user_infos[0]->prix_total, $title);
         $content = str_replace("%prix_total%", $user_infos[0]->prix_total, $content);
         $content = str_replace("%USERNAME%", $user->display_name, $content);
         $content = str_replace("%evenement%", $event_name, $content);
         $content = str_replace("%nbplace_enf%", $user_infos[0]->nbplace_enf, $content);
         $content = str_replace("%nbplace%", $user_infos[0]->nbplace, $content);
         $content = str_replace("%prix_place%", $tarif_adulte, $content);
         $content = str_replace("%prix_place_enf%", $tarif_enf, $content);
         $content = str_replace("%prix_place_adh%", $tarif_adh, $content);
         $content = str_replace("%lien%", get_site_url() . "/?p=" . $infos[1], $content);
         $isSent = wp_mail($infos[0], $title, $content);
     }
     if ($isSent) {
         $last_query = $wpdb->update('cjm_reservation', array("mail_confirm" => 1), array("id_evenement" => $infos[1], "id_participant" => $user_id), array("%d"), array("%d", "%d"));
     }
     echo json_encode($last_query);
     // echo json_encode(array($last_query,$datas));
     // echo json_encode("test");
 }
Example #30
0
function cr(&$fields, &$errors)
{
    // Check args and replace if necessary
    if (!is_array($fields)) {
        $fields = array();
    }
    if (!is_wp_error($errors)) {
        $errors = new WP_Error();
    }
    // Check for form submit
    if (isset($_POST['submit'])) {
        // Get fields from submitted form
        $fields = cr_get_fields();
        // Validate fields and produce errors
        if (cr_validate($fields, $errors)) {
            // If successful, register user
            wp_insert_user($fields);
            // And display a message
            echo 'Registration complete. Goto <a href="' . get_site_url() . '/wp-login.php">login page</a>.';
            // Clear field data
            $fields = array();
        }
    }
    // Santitize fields
    cr_sanitize($fields);
    // Generate form
    cr_display_form($fields, $errors);
}