This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$query = 'SELECT `wp_posts`.`ID`, `wp_posts`.`guid`, `wp_postmeta`.`meta_value` | |
FROM `wp_posts`, `wp_postmeta` | |
WHERE `post_type` = "attachment" | |
AND `wp_posts`.`ID` = `wp_postmeta`.`post_id` | |
AND `wp_postmeta`.`meta_key` = "_wp_attachment_metadata" | |
AND `wp_postmeta`.`meta_value` REGEXP \'^a:[[:alnum:]]+:{s:5:"width";i:$$$PIXELS_WIDTH$$;s:6:"height";i:$$$PIXELS_HEIGHT$$$;s:4:"file";s:[[:alnum:]]+:"(.*?/|)$$$FILENAME$$$"\''; | |
$query = str_replace('$$$PIXELS_WIDTH$$$', $width, $query); | |
$query = str_replace('$$$PIXELS_HEIGHT$$$', $height, $query); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
stream_context_set_default( ['http' => ['method' => 'HEAD'] ] ); | |
$head = array_change_key_case( get_headers( $fullremotefilename, 1 ) ); | |
$content_length = isset($head['content-length']) ? (int)( $head['content-length'] ) : 0; | |
if ( $content_length ) { | |
$img_size = @filesize( $localfilename ); | |
if ( $img_size !== false && $img_size !== $content_length ) { | |
// images match! | |
} else { | |
// images don't match |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$query = 'SELECT `wp_posts`.`ID`, `wp_posts`.`guid`, `wp_postmeta`.`meta_value` | |
FROM `wp_posts`, `wp_postmeta` | |
WHERE `post_type` = "attachment" | |
AND `wp_posts`.`ID` = `wp_postmeta`.`post_id` | |
AND `wp_postmeta`.`meta_key` = "_wp_attachment_metadata" | |
AND `wp_postmeta`.`meta_value` LIKE \'a:%:{s:5:"width";i:$$$PIXELS_WIDTH$$$;s:6:"height";i:$$$PIXELS_HEIGHT$$$;s:4:"file";s:%:"%$$$FILENAME$$$"%\''; | |
$query = str_replace('$$$PIXELS_WIDTH$$$', $width, $query); | |
$query = str_replace('$$$PIXELS_HEIGHT$$$', $height, $query); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$image_src = wp_upload_dir()['baseurl'] . '/' . _wp_relative_upload_path( $filename ); | |
$query = "SELECT COUNT(*) FROM {$wpdb->posts} WHERE guid='$image_src'"; | |
$count = intval($wpdb->get_var($query)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local return_code="%(?..%{$FG[209]%}%? %{$reset_color%})" | |
PROMPT='%{$FG[110]%}{ %c } \ | |
%{$FG[150]%}$( git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "" )%{$reset_color%} \ | |
%{$FG[209]%}%(!.#.»)%{$reset_color%} ' | |
PROMPT2='%{$FG[209]%}\ %{$reset_color%}' | |
RPS1='%{$FG[223]%}%n@%m: %{$reset_color%}\ | |
%{$FG[110]%}%~%{$reset_color%} ${return_code}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace MyApp; | |
use Config; | |
trait LocalPathsTrait | |
{ | |
/** | |
* Replaces remote URL to Local Path | |
* | |
* @param string $url remote image or file (with http and www stuff) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait PresentersHelper | |
{ | |
/** | |
* @param \Carbon\Carbon $date | |
* | |
* @return string | |
*/ | |
public function niceTime( $date = null ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Laracasts\Presenter\Presenter; | |
abstract class AbstractPresenter extends Presenter | |
{ | |
/** | |
* @param \Carbon\Carbon $date | |
* | |
* @return string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isTransactionTrackingPresent(symbol) | |
{ | |
symbol = symbol || 'trackTrans'; | |
var present = false; | |
var script_tags = document.getElementsByTagName("script"); | |
Array.prototype.slice.call(script_tags).forEach( function(tag) | |
{ | |
if ( present ) return; | |
var source = tag.innerText || tag.textContent; | |
if ( source && source.indexOf(symbol) != -1 ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Lazy loads relationship if required | |
* | |
* @param \Eloquent $model | |
* @param string $relationship | |
* | |
* @return object | |
*/ |
NewerOlder