function load_parameters() { // Load Parameters $_REQUEST = Array_Merge(array('a' => 0, 'h' => 0, 'w' => 0, 'c' => 0, 'g' => 0, 'q' => 80), $_REQUEST); $this->attachment_id = IntVal($_REQUEST['a']); if ($this->attachment_id < 1) { die('I do not think that ' . $this->attachment_id . ' is a valid attachment id.'); } $this->attachment_file = RealPath(get_attached_file($this->attachment_id)); if (!Is_File($this->attachment_file)) { die('Could not find this attachment.'); } $this->dst_height = IntVal($_REQUEST['h']); if ($this->dst_height < 1) { $this->dst_height = 0; } $this->dst_width = IntVal($_REQUEST['w']); if ($this->dst_width < 1) { $this->dst_width = 0; } if ($this->dst_width < 1 && $this->dst_height < 1) { die('New dimensions cannot be less then 1.'); } $this->crop = IntVal($_REQUEST['c']); if ($this->crop == 0) { $this->crop = False; } else { $this->crop = True; } if ($this->crop && ($this->dst_width < 1 || $this->dst_height < 1)) { die('If you want something cropped please tell me the dimensions.'); } $this->grayscale = IntVal($_REQUEST['g']); if ($this->grayscale == 0) { $this->grayscale = False; } else { $this->grayscale = True; } $this->negate = IntVal($_REQUEST['n']); if ($this->negate == 0) { $this->negate = False; } else { $this->negate = True; } $this->dst_qualy = IntVal($_REQUEST['q']); if ($this->dst_qualy < 1 || $this->dst_qualy > 100) { $this->dst_qualy = 80; } }
static function loadBaseURL() { $absolute_plugin_folder = RealPath(self::$plugin_folder); if (StrPos($absolute_plugin_folder, ABSPATH) === 0) { self::$base_url = Get_Bloginfo('wpurl') . '/' . SubStr($absolute_plugin_folder, Strlen(ABSPATH)); } else { self::$base_url = Plugins_Url(BaseName(self::$plugin_folder)); } self::$base_url = Str_Replace("\\", '/', self::$base_url); # Windows Workaround }
private function Load_Base_Url() { $absolute_plugin_folder = RealPath(DirName(__FILE__)); if (StrPos($absolute_plugin_folder, ABSPATH) === 0) { $this->base_url = Get_Bloginfo('wpurl') . '/' . SubStr($absolute_plugin_folder, Strlen(ABSPATH)); } else { $this->base_url = Plugins_Url(BaseName(DirName(__FILE__))); } $this->base_url = Str_Replace("\\", '/', $this->base_url); # Windows Workaround }
function __construct() { if (Is_Admin() && !$this->Validate_Licence()) { $this->base_url = get_bloginfo('wpurl') . '/' . Str_Replace("\\", '/', SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH))); Add_Action('admin_init', array($this, 'Load_TextDomain')); Add_Action('admin_init', array($this, 'Add_Contribution_Code_Field')); Add_Action('admin_print_footer_scripts', array($this, 'Print_Contribution_JS'), 99); Add_Action('admin_notices', array($this, 'Print_Contribution_Form'), 1); Add_Action('wp_dashboard_setup', array($this, 'Register_Dashboard_Widget'), 9); Add_Action('donation_message', array($this, 'Print_Contribution_Message')); Add_Action('dh_contribution_message', array($this, 'Print_Contribution_Message')); } $this->Check_Remote_Activation(); }
function get_files($directory) { $arr_file = (array) Glob($directory . '{,.}*', GLOB_BRACE); $sort_order = array(); foreach ($arr_file as $index => $file) { $path = RealPath($file); if (!Is_File($path)) { unset($arr_file[$index]); } else { $arr_file[$index] = $path; $sort_order[$index] = StrToLower($file); } } Array_Multisort($sort_order, $arr_file); return $arr_file; }
function __construct() { // Read base $this->base_url = get_bloginfo('wpurl') . '/' . Str_Replace("\\", '/', SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH))); // Get ready to translate $this->Load_TextDomain(); // Set Hooks if (Is_Admin()) { Add_Action('admin_menu', array($this, 'add_options_page')); Add_Action('admin_head', array($this, 'print_admin_header')); } else { Add_Action('wp_head', array($this, 'print_header')); Add_ShortCode('gallery', array($this, 'gallery_shortcode')); } // Add jQuery wp_enqueue_script('jquery'); }
<?php /* Fancy Gallery Template: Thumbnails / Image Title with Share buttons Description: This template displays the thumbnail images and the image title with share buttons. Version: 1.0.1 Author: Dennis Hoppe Author URI: http://DennisHoppe.de */ // Read base url $base_url = SPrintF('%s/%s', Get_Bloginfo('wpurl'), SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH))); $base_url = Str_Replace("\\", '/', $base_url); // Windows Workaround ?> <div class="gallery fancy-gallery <?php echo BaseName(__FILE__, '.php'); ?> " id="gallery_<?php echo $this->gallery->id; ?> "><?php foreach ($this->gallery->images as $image) { // Build <img> Tags $img_code = '<img'; foreach ($image->attributes as $attribute => $value) { $img_code .= SPrintF(' %s="%s"', $attribute, HTMLSpecialChars(Strip_Tags($value))); } $img_code .= '>'; // Build FB share button $fb_code = SPrintF('<a href="%1$s" title="%2$s" class="%3$s" target="_blank">%4$s</a>', SPrintF('https://www.facebook.com/sharer/sharer.php?u=%s', $image->href), HTMLSpecialChars($image->title), $this->gallery->attributes->link_class, SPrintF('<img src="%s/facebook-button.png" alt="Share it" height="20">', $base_url)); // Build Pintarest share button
<?php // $Id: map.php 203 2014-03-23 07:55:38Z paul $ // Start page ob_start(); require "../php/dbconnect.php"; ob_end_clean(); session_start(); ignore_user_abort(false); // Get working parameters $userno = isset($_SESSION['sp_userno']) ? $userno = $_SESSION['sp_userno'] : ($userno = -5); $gameno = isset($_GET['xgame']) ? $_GET['xgame'] : (isset($_SESSION['sp_gameno']) ? $_SESSION['sp_gameno'] : 0); // Create the image $font = RealPath('../themes/img/verdanab.ttf'); $map = ImageCreateFromPNG('../themes/img/supremacy map.png'); // Find out what size map is required $xsize = isset($_GET['xsize']) ? $_GET['xsize'] : ImagesX($map); if ($xsize <= 200) { $ysize = $xsize; } else { $ysize = ImagesY($map) * $xsize / ImagesX($map); } // Set colours up $white = ImageColorExact($map, 255, 255, 255); $black = ImageColorExact($map, 0, 0, 0); $blue = ImageColorExact($map, 0, 200, 235); $minerals = ImageColorExact($map, 233, 238, 18); $oil = ImageColorExact($map, 254, 0, 254); $grain = ImageColorExact($map, 41, 215, 78); if ($xsize > 200) { $result = $mysqli->query("Select red, green, blue From sp_resource r Left Join sp_powers pw On r.powername=pw.powername Where userno={$userno}");
function Resampled_Image_URL($attachment_id, $width = 0, $height = 0, $crop = False, $grayscale = False, $negate = False, $qualy = 80) { global $blog_id; // Mime Type list($attachment_mime, $attachment_type) = Explode('/', get_post_mime_type($attachment_id)); // Attachment file $attachment_file = RealPath(get_attached_file($attachment_id)); // Read Cache Directory and URL $cache_file_name = '/image_thumbs/' . IntVal($blog_id) . '-' . IntVal($attachment_id) . '-' . IntVal($width) . '-' . IntVal($height) . '-' . IntVal($crop) . '-' . IntVal($grayscale) . '-' . IntVal($negate) . '-' . IntVal($qualy) . '.' . $attachment_type; if (Is_File(WP_CONTENT_DIR . $cache_file_name) && Is_File($attachment_file) && FileSize(WP_CONTENT_DIR . $cache_file_name) > 0 && FileMTime(WP_CONTENT_DIR . $cache_file_name) > FileMTime($attachment_file)) { return WP_CONTENT_URL . $cache_file_name; } else { return $this->base_url . '/wp-thumb.php?' . HTTP_Build_Query(array('a' => IntVal($attachment_id), 'w' => IntVal($width), 'h' => IntVal($height), 'c' => IntVal($crop), 'g' => IntVal($grayscale), 'n' => IntVal($negate), 'q' => IntVal($qualy))); } }