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 getPostAuthors() { | |
global $wpdb; | |
$authors = array(); | |
$results = $wpdb->get_results( $wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE (post_type = '%s' AND ID = %d) OR (post_type = 'revision' AND post_parent = %d) GROUP BY post_author", get_post_type( get_the_ID() ), get_the_ID(), get_the_ID() ) ); | |
foreach ($results as $row) { | |
if (isset($coma)) { | |
echo $coma; | |
} else { | |
$coma = ', '; | |
} |
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
$select= $this->_getTable()->select()->setIntegrityCheck(false) | |
->from(array('BLG' => 'articles'), array('month' => new Zend_Db_Expr($m), 'count' => new Zend_Db_Expr('COUNT(BLG.id_articles)'))) | |
->joinLeft( | |
array('LNG' => 'languages'), | |
'LNG.id_languages = BLG.id_languages', | |
array('lang' => 'code') | |
) | |
->where('LNG.code = ?', $lang) | |
; |
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
http://www.queness.com/post/14256/10-powerful-responsive-lightboxes |
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
JQUERY: //ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js | |
GITHUB: https://github.com/theproductguy/ThreeDots | |
<div class='text_here' style="width: 200px;"> | |
<span class='ellipsis_text'> | |
TEXT | |
</span> | |
</div> | |
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
NUMBER FORMAT: | |
return number_format((float)$number, 2, '.', ''); | |
SPRINTF: | |
$padded = sprintf('%0.2f', $unpadded); // 520 -> 520.00 | |
ROUND: | |
<?php | |
echo round(3.4); // 3 | |
echo round(3.5); // 4 |
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 | |
// STEP 1: read POST data | |
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST. | |
// Instead, read raw POST data from the input stream. | |
$raw_post_data = file_get_contents('php://input'); | |
$raw_post_array = explode('&', $raw_post_data); | |
$myPost = array(); | |
foreach ($raw_post_array as $keyval) { | |
$keyval = explode ('=', $keyval); |
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
$translator = $this->view->getHelper('translate')->getTranslator(); | |
$translator->setLocale($order->getLanguage()->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
$this->_helper->redirector->gotoRouteAndExit(array(), 'backend-module-controller'); | |
$params = array(); | |
$this->forward('denied', 'error', 'default', $params); | |
return; |
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
// in controller action | |
$this->_helper->viewRenderer->setNeverRender(); | |
$this->_helper->layout()->disableLayout(); |
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
$server = $this->getRequest()->getServer(); | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, $url); | |
curl_setopt($curl, CURLOPT_POST, true); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($curl, CURLOPT_TIMEOUT, 90); // times out after 90s | |
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params)); |
OlderNewer