示例#1
0
 /**
  *    商品分享索引
  *
  *    @author    Hyber
  *    @return    void
  */
 function index()
 {
     $shares = $this->_m_share->getAll();
     $shares = array_msort($shares, array('sort_order' => SORT_ASC));
     $this->import_resource(array('script' => 'inline_edit.js'));
     $this->assign('shares', $shares);
     $this->assign('type', $this->_get_share_type());
     $this->display('share.index.html');
 }
示例#2
0
function getOptions($label, $subtype = "")
{
    global $dirEntities;
    global $dirOptions;
    global $dirTei;
    $files = glob($dirTei . "/*.xml");
    $entities = simplexml_load_file($dirEntities . "/namedEntities.xml");
    if ($subtype != "") {
        $options = $entities->xpath("//row[type='persName']");
        $output = $subtype . ".html";
    } else {
        $options = $entities->xpath("//row[type='" . $label . "']");
        $output = $label . ".html";
    }
    $results = array();
    foreach ($options as $option) {
        $id = (string) $option->id[0];
        $name = (string) $option->nom[0];
        if ($subtype != "") {
            foreach ($files as $file) {
                $file = simplexml_load_file($file);
                $file->registerXPathNamespace('t', 'http://www.tei-c.org/ns/1.0');
                if ($subtype == "present") {
                    $request = "//t:list[@type='present']/t:item/t:persName[@ref='#" . $id . "']";
                } else {
                    $request = "//t:persName[@role='" . $subtype . "'][@ref='#" . $id . "']";
                }
                if (count($file->xpath($request)) > 0) {
                    array_push($results, array("id" => "#" . $id, "name" => $name));
                }
            }
        } else {
            array_push($results, array("id" => "#" . $id, "name" => $name));
        }
    }
    //delete duplicate
    $results = array_map("unserialize", array_unique(array_map("serialize", $results)));
    //order
    $results = array_msort($results, array('name' => SORT_ASC, 'id' => SORT_ASC));
    $html = "";
    foreach ($results as $result) {
        $html .= "<option value='" . $result["id"] . "'>" . $result["name"] . "</option>";
    }
    file_put_contents($dirOptions . "/" . $output, $html);
}
示例#3
0
 function _get_share($goods)
 {
     $m_share =& af('share');
     $shares = $m_share->getAll();
     $shares = array_msort($shares, array('sort_order' => SORT_ASC));
     $goods_name = ecm_iconv(CHARSET, 'utf-8', $goods['goods_name']);
     $goods_url = urlencode(SITE_URL . '/' . str_replace('&amp;', '&', url('app=goods&id=' . $goods['goods_id'])));
     $site_title = ecm_iconv(CHARSET, 'utf-8', Conf::get('site_title'));
     $share_title = urlencode($goods_name . '-' . $site_title);
     foreach ($shares as $share_id => $share) {
         $shares[$share_id]['link'] = str_replace(array('{$link}', '{$title}'), array($goods_url, $share_title), $share['link']);
     }
     return $shares;
 }
示例#4
0
                        <li><?php 
    echo $theme['nom'];
    ?>
</li>
                    <?php 
}
?>
                </ul>
            </aside>
        </div>

        <div id="formations_list" class="container">
            <div id="works_list_on"></div>
            <div id="tmp"></div>
            <?php 
foreach (array_msort(get_resum_formation(), array('nom' => SORT_ASC)) as $formation) {
    ?>
                <div data-name="<?php 
    echo $formation['nom'];
    ?>
" class="work_list hover-effect_with-move col-md-12 col-sm-12 col-xs-12 <?php 
    foreach (get_themes_by_formation($formation['id']) as $theme_formation) {
        echo mb_strtolower($theme_formation['nom_theme']) . ' ';
    }
    ?>
">
                    <img src="img/formations/<?php 
    echo !empty($formation['image']) ? $formation['image'] : 'empty_formation';
    ?>
.jpg" alt="Image formation"/>
                    <div class="work_box_content">
 function rechnung_schreiben_positionen_wahl($kostentraeger_typ, $kostentraeger_id, $positionen, $aussteller_typ, $aussteller_id)
 {
     if (isset($_REQUEST['csv'])) {
         $this->pool_csv($kos_typ, $kos_id, $positionen, $aussteller_typ, $aussteller_id);
         die;
     }
     // echo "<pre>";
     // print_r($positionen);
     // echo "</pre>";
     // die();
     $f = new formular();
     $f->erstelle_formular("Rechnung aus Pool zusammenstellen", NULL);
     $f->hidden_feld('option', 'AUTO_RECHNUNG_VORSCHAU');
     // $js_action = 'onblur="javascript:rechnung_pool_neuberechnen(this.form)" onchange="javascript:rechnung_pool_neuberechnen(this.form)" onfocus="javascript:rechnung_pool_neuberechnen(this.form)" onmouseover="javascript:rechnung_pool_neuberechnen(this.form)"';
     $js_action = 'onmouseover="javascript:pool_berechnung(this.form)" onkeyup="javascript:pool_berechnung(this.form)" onmousedown="javascript:pool_berechnung(this.form)" onmouseup="javascript:pool_berechnung(this.form)" onmousemove="javascript:pool_berechnung(this.form)"';
     $objekt_info = new objekt();
     if ($kostentraeger_typ == 'Objekt') {
         $objekt_info->get_objekt_eigentuemer_partner($kostentraeger_id);
         $rechnungs_empfaenger_id = $objekt_info->objekt_eigentuemer_partner_id;
     }
     if ($kostentraeger_typ == 'Einheit') {
         $this->get_empfaenger_infos($kostentraeger_typ, $kostentraeger_id);
         $rechnungs_empfaenger_typ = $this->rechnungs_empfaenger_typ;
         $rechnungs_empfaenger_id = $this->rechnungs_empfaenger_id;
     }
     if ($kostentraeger_typ == 'Lager') {
         $rechnungs_empfaenger_id = $kostentraeger_id;
         /*
          * $l = new lager;
          * $l->lager_name_partner($kostentraeger_id);
          * $rechnungs_empfaenger_typ = 'Partner';
          * $rechnungs_empfaenger_id = $l->lager_partner_id;
          */
     }
     if ($kostentraeger_typ == 'Partner') {
         $rechnungs_empfaenger_id = $kostentraeger_id;
     }
     // $positionen = array_sortByIndex($positionen,'BELEG_NR');
     // $positionen = array_sortByIndex($positionen,'POSITION');
     // $positionen = array_orderby($positionen, 'BELEG_NR', SORT_DESC, 'POSITION', SORT_DESC);
     $positionen = array_msort($positionen, array('BELEG_NR' => array(SORT_ASC), 'POSITION' => SORT_STRING));
     $this->rechnungs_kopf_zusammenstellung($kostentraeger_typ, $kostentraeger_id, $aussteller_typ, $aussteller_id);
     // echo '<pre>';
     // print_r($positionen1);
     // die();
     $self = $_SERVER['QUERY_STRING'];
     echo "<a href=\"?{$self}&csv\">Als Excel</a>";
     echo "<table id=\"pos_tabelle\" class=rechnungen>";
     echo "<tr><td colspan=3>";
     $faellig_am = date("Y-m-t");
     $faellig_am = date_mysql2german($faellig_am);
     $d_heute = date("d.m.Y");
     $f->datum_feld('Rechnungsdatum', 'rechnungsdatum', "{$d_heute}", 'rechnungsdatum');
     $f->datum_feld('Faellig am', 'faellig_am', "{$faellig_am}", 'faellig_am');
     // $f->text_feld("Skonto in %:", "skonto", "0", "5", "skonto_feld", $js_action);
     echo "</td><td colspan=6>";
     echo "</td></tr>";
     echo "<tr><td colspan=\"6\">";
     // if($aussteller_typ == 'Partner'){
     $geld_konto_info = new geldkonto_info();
     $geld_konto_info->dropdown_geldkonten($aussteller_typ, $aussteller_id);
     // }else{
     // $form->hidden_feld('geld_konto', '0');
     // }
     echo "</td></tr>";
     // onMouseover=\"BoxenAktivieren(this);
     echo "<div id=\"pool_tabelle\" {$js_action}>";
     // echo "<tr class=feldernamen><td width=\"30px\"><input type=\"checkbox\" onClick=\"this.value=check(this.form.positionen_list)\" $js_action>Alle</td><td>Rechnung</td><td>Position</td><td>Menge</td><td>Bezeichnung</td><td>Einzelpreis</td><td>Netto</td><td>Rabatt %</td><td>Skonto</td><td>MWSt</td><td>Kostentraeger</td></tr>";
     echo "<tr ><th>POOL</th><th><input type=\"checkbox\" onClick=\"this.value=check(this.form.positionen_list)\" {$js_action}>Alle</th><th>Rechnung</th><th>UPos</th><th>Pos</th><th>Menge</th><th>Bezeichnung</th><th>Einzelpreis</th><th>Netto</th><th>Rabatt %</th><th>Skonto</th><th>MWSt</th><th>Kostentraeger</th></tr>";
     $f->hidden_feld('RECHNUNG_EMPFAENGER_TYP', "{$kostentraeger_typ}");
     $f->hidden_feld('RECHNUNG_EMPFAENGER_ID', "{$rechnungs_empfaenger_id}");
     $f->hidden_feld('RECHNUNG_AUSSTELLER_TYP', "{$aussteller_typ}");
     $f->hidden_feld('RECHNUNG_AUSSTELLER_ID', "{$aussteller_id}");
     $f->hidden_feld('RECHNUNG_KOSTENTRAEGER_ID', "{$kostentraeger_id}");
     $f->hidden_feld('RECHNUNG_KOSTENTRAEGER_TYP', "{$kostentraeger_typ}");
     $rechnungs_summe = 0;
     $start = 3;
     // nummer of <tr>
     for ($a = 0; $a < count($positionen); $a++) {
         $start++;
         $zeile = $a + 1;
         $belegnr = $positionen[$a]['BELEG_NR'];
         $this->rechnung_grunddaten_holen($belegnr);
         $f->hidden_feld("positionen[{$a}][beleg_nr]", "{$belegnr}");
         $position = $positionen[$a]['POSITION'];
         $f->hidden_feld("positionen[{$a}][position]", "{$position}");
         $artikel_bezeichnung = $this->kontierungsartikel_holen($belegnr, $position);
         $pos_kostentraeger_typ = $positionen[$a]['KOSTENTRAEGER_TYP'];
         $pos_kostentraeger_id = $positionen[$a]['KOSTENTRAEGER_ID'];
         $kostentraeger = $this->kostentraeger_ermitteln($pos_kostentraeger_typ, $pos_kostentraeger_id);
         $menge = nummer_punkt2komma($positionen[$a]['MENGE']);
         $epreis = nummer_punkt2komma($positionen[$a]['EINZEL_PREIS']);
         $gpreis = nummer_punkt2komma($positionen[$a]['GESAMT_SUMME']);
         $rabatt_satz = nummer_punkt2komma($positionen[$a]['RABATT_SATZ']);
         $skonto = nummer_punkt2komma($positionen[$a]['SKONTO']);
         $rechnungs_summe = $rechnungs_summe + nummer_komma2punkt($menge) * nummer_komma2punkt($epreis);
         $mwst_satz_in_prozent = nummer_punkt2komma($this->mwst_satz_der_position($belegnr, $position));
         // aus Beleg infos holen //
         $kontierung_id = $positionen[$a]['KONTIERUNG_ID'];
         $kontierung_dat = $positionen[$a]['KONTIERUNG_DAT'];
         $f->hidden_feld("positionen[{$a}][kontierung_dat]", "{$kontierung_dat}");
         $link_rechnung_ansehen = "<a href=\"index.php?daten=rechnungen&option=rechnungs_uebersicht&belegnr={$belegnr}\">{$this->rechnungsnummer}</a>";
         echo "<tr id=\"tr_zeile.{$start}\"><td>";
         $rrr = new rechnungen();
         /*
          * $pool_bez = substr($rrr->get_pool_bez($_SESSION['pool_id'],0,5));
          * $pool_bez = $rrr->get_pool_bez($_SESSION['pool_id']);
          */
         // $js_weiter = "onclick=\"pool_wahl('Rechnung aus Pool zusammenstellen', '$kontierung_dat', '$kostentraeger_typ', '$kostentraeger_id')\"";
         // $js_weiter = "onclick=\"pool_wahl('Rechnung aus Pool zusammenstellen', 'this.form.positionen', '$kostentraeger_typ', '$kostentraeger_id')\"";
         // $idid = "tr_zeile".$start;
         // $js_weiter = "onclick=\"deleteCurrentRow(this)\"";
         // $js_weiter = "onclick=\"zeile_entfernen(this, 'dat', 'kos_typ', 'kos_id', 'pool_id')\"";
         // $f->button_js('ip', "$pool_bez", $js_weiter);
         /*
          * $f->button_js('ip', "$pool_bez", $js_weiter);
          * $f->button_js('ip', "$pool_bez", $js_weiter);
          */
         // echo $pool_bez;
         $rrr->btn_pool($kostentraeger_typ, $kostentraeger_id, $kontierung_dat, 'this');
         echo "</td><td>{$zeile}<input type=\"checkbox\" name=uebernehmen[] id=\"positionen_list\" value=\"{$a}\" {$js_action}></td><td>{$link_rechnung_ansehen}</td><td>{$position}</td><td>{$zeile}.</td><td>";
         $f->text_feld("Menge:", "positionen[{$a}][menge]", "{$menge}", "5", "mengen_feld", $js_action);
         // $f->hidden_feld("positionen[$a][bezeichnung]", "$artikel_bezeichnung");
         echo "</td><td>{$artikel_bezeichnung}</td><td>";
         $f->text_feld("Einzelpreis:", "positionen[{$a}][preis]", "{$epreis}", "8", "epreis_feld", $js_action);
         echo "</td><td>";
         $f->text_feld_inaktiv("Netto:", "", "{$gpreis}", "8", "netto_feld", $js_action);
         echo "</td><td>";
         // $gpreis_brutto = ($gpreis / 100) * (100 + $rechnung->rechnungs_mwst_satz);
         $gpreis_brutto = $gpreis / 100 * (100 + $mwst_satz_in_prozent);
         $gpreis_brutto = $gpreis_brutto * 100 / 100;
         $gpreis_brutto = nummer_punkt2komma($gpreis_brutto);
         // $form->text_feld("Brutto:", "positionen[$a][gpreis_brutto]", "$gpreis_brutto", "5");
         $f->text_feld("Rabatt:", "positionen[{$a}][rabatt_satz]", "{$rabatt_satz}", "5", "rabatt_feld", $js_action);
         // $f->hidden_feld("positionen[$a][pos_mwst]", "$mwst_satz_in_prozent");
         echo "</td><td>";
         $f->text_feld("Skonto:", "positionen[{$a}][skonto]", "{$skonto}", "5", "skonto_feld", $js_action);
         // $f->hidden_feld("positionen[$a][pos_mwst]", "$mwst_satz_in_prozent");
         echo "</td><td>";
         $f->text_feld("Mwst:", "mwst_satz", "{$mwst_satz_in_prozent}", "3", "mwst_feld", $js_action);
         echo "</td><td valign=bottom>{$kostentraeger}</td></tr>";
         // $f->hidden_feld("positionen[$a][kontierung_id]", "$kontierung_id");
     }
     echo "<tr><td colspan=10><hr></td></tr></table>";
     echo "<table>";
     // echo "<tr><td><input type=\"checkbox\" name=\"in_rechung_stellen\" id=\"in_rechung_stellen\" onclick=\"check_ob_pos_gewaehlt(this, this.form.positionen_list)\"><b>Eingabe beenden</b></td>\n</tr>";
     echo "<tr><td>";
     $f->text_bereich('Kurzbeschreibung', 'kurzbeschreibung', '', 30, 30, 'kurzbeschreibung');
     echo "<br>";
     $f->send_button_disabled("senden_pos", "Speichern deaktiviert", "speichern_button2");
     echo "</td></tr>";
     echo "<tr><td colspan=9><hr></td></tr>";
     echo "<tr><td colspan=8 align=right>Netto ausgewählte Positionen</td><td id=\"g_netto_ausgewaehlt\"></td></tr>";
     echo "<tr><td colspan=8 align=right>Brutto ausgewählte Positionen</td><td id=\"g_brutto_ausgewaehlt\"></td></tr>";
     echo "<tr><td colspan=8 align=right>Skontonachlass</td><td id=\"g_skonto_nachlass\"></td></tr>";
     echo "<tr><td colspan=8 align=right>Skontobetrag</td><td id=\"g_skonto_betrag\"></td></tr>";
     echo "<tr><td colspan=9><hr></td></tr>";
     /*
      * echo "<tr><td colspan=8 align=right>Gesamt Netto errechnet</td><td id=\"g_netto_errechnet\"></td></tr>";
      * echo "<tr><td colspan=8 align=right>Gesamt Brutto errechnet</td><td id=\"g_brutto_errechnet\"></td></tr>";
      * echo "<tr><td colspan=8 align=right>Durchschnittsrabatt im Pool</td><td id=\"durchschnitt_rabatt\"></td></tr>";
      */
     echo "</table>";
     echo "</div>";
     $f->ende_formular();
 }
function netsposts_shortcode($atts)
{
    /* below is my updates */
    extract(shortcode_atts(array('limit' => '', 'days' => 0, 'page_title_style' => '', 'title' => '', 'titles_only' => false, 'wrap_start' => null, 'wrap_end' => null, 'thumbnail' => false, 'post_type' => 'post', 'include_blog' => null, 'exclude_blog' => null, 'exclude_post' => null, 'include_post' => null, 'title_length' => 999, 'taxonomy' => '', 'paginate' => false, 'pages' => null, 'list' => 10, 'excerpt_length' => 400, 'auto_excerpt' => false, 'show_author' => false, 'full_text' => false, 'size' => 'thumbnail', 'image_class' => 'post-thumbnail', 'date_format' => 'n/j/Y', 'end_size' => '', 'mid_size' => '', 'prev_next' => false, 'prev' => '&laquo; Previous', 'next' => 'Next &raquo;', 'column' => '1', 'column_width' => '200', 'title_color' => '', 'text_color' => '', 'meta_info' => 'true', 'wrap_title_start' => '', 'wrap_title_end' => '', 'wrap_image_start' => '', 'wrap_image_end' => '', 'wrap_text_start' => '', 'wrap_text_end' => '', 'meta_width' => '100%', 'menu_name' => '', 'menu_class' => '', 'container_class' => '', 'post_height' => null, 'manual_excerpt_length' => null, 'random' => false, 'order_post_by' => ''), $atts));
    /* my updates are finished here */
    ########  OUTPUT STAFF  ####################
    $titles_only = strtolower($titles_only) == 'true' ? true : false;
    $thumbnail = strtolower($thumbnail) == 'true' ? true : false;
    $paginate = strtolower($paginate) == 'true' ? true : false;
    $auto_excerpt = strtolower($auto_excerpt) == 'true' ? true : false;
    $show_author = strtolower($show_author) == 'true' ? true : false;
    $full_text = strtolower($full_text) == 'true' ? true : false;
    $prev_next = strtolower($prev_next) == 'true' ? true : false;
    /* below is my updates */
    $random = strtolower($random) == 'true' ? true : false;
    /* my updates are finished here */
    global $wpdb;
    global $table_prefix;
    if ($limit) {
        $limit = " LIMIT 0,{$limit} ";
    }
    ## Params for taxonomy
    if ($cat) {
        if ($tag) {
            implode(',', $cat, $tag);
        }
    } else {
        $cat = $tag;
    }
    ## Include blogs
    if ($include_blog) {
        $include_arr = explode(",", $include_blog);
        $include = " AND (";
        foreach ($include_arr as $included_blog) {
            $include .= " blog_id = {$included_blog}  OR";
        }
        $include = substr($include, 0, strlen($include) - 2);
        $include .= ")";
    } else {
        if ($exclude_blog) {
            $exclude_arr = explode(",", $exclude_blog);
            foreach ($exclude_arr as $exclude_blog) {
                $exclude .= "AND blog_id != {$exclude_blog}  ";
            }
        }
    }
    $BlogsTable = $wpdb->base_prefix . 'blogs';
    /* below is my updates */
    if ($random) {
        $page = get_query_var('paged');
        if (!$page) {
            $page = get_query_var('page');
        }
        if (!$page) {
            $page = 1;
        }
        if ($page > 1 && $paginate) {
            $blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$BlogsTable} WHERE public = %d AND archived = %d AND mature = %d AND spam = %d AND deleted = %d {$include} {$exclude}  ", 1, 0, 0, 0, 0));
        } else {
            $blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$BlogsTable} WHERE public = %d AND archived = %d AND mature = %d AND spam = %d AND deleted = %d {$include} {$exclude} ORDER BY RAND() ", 1, 0, 0, 0, 0));
        }
    } else {
        $blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$BlogsTable} WHERE public = %d AND archived = %d AND mature = %d AND spam = %d AND deleted = %d {$include} {$exclude}  ", 1, 0, 0, 0, 0));
    }
    /* my updates are finished here */
    ## Getting posts
    $postdata = array();
    if ($blogs) {
        foreach ($blogs as $blog_id) {
            if ($blog_id == 1) {
                $OptionsTable = $wpdb->base_prefix . "options";
                $PostsTable = $wpdb->base_prefix . "posts";
                $TermRelationshipTable = $wpdb->base_prefix . "term_relationships";
                $TermTaxonomyTable = $wpdb->base_prefix . "term_taxonomy";
                $TermsTable = $wpdb->base_prefix . "terms";
            } else {
                $OptionsTableTable = $wpdb->base_prefix . $blog_id . "_options";
                $PostsTable = $wpdb->base_prefix . $blog_id . "_posts";
                $TermRelationshipTable = $wpdb->base_prefix . $blog_id . "_term_relationships";
                $TermTaxonomyTable = $wpdb->base_prefix . $blog_id . "_term_taxonomy";
                $TermsTable = $wpdb->base_prefix . $blog_id . "_terms";
            }
            if ($days > 0) {
                $old = "AND {$PostsTable}.post_date >= DATE_SUB(CURRENT_DATE(), INTERVAL {$days} DAY)";
            } else {
                $old = "";
            }
            ## Taxonomy
            if ($taxonomy) {
                $categories = explode(',', $taxonomy);
                $cat_arr = array();
                foreach ($categories as $category) {
                    $cat_id = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM {$TermsTable} WHERE slug = '{$category}' "));
                    if ($cat_id) {
                        $cat_arr[] = $cat_id;
                    }
                }
                $taxonomy_arr = array();
                foreach ($cat_arr as $cat_id) {
                    $tax_id = $wpdb->get_var($wpdb->prepare("SELECT term_taxonomy_id FROM {$TermTaxonomyTable} WHERE  term_id = {$cat_id}"));
                    if ($tax_id) {
                        $taxonomy_arr[] = $tax_id;
                    }
                }
                foreach ($taxonomy_arr as $tax_id) {
                    $post_ids = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM {$TermRelationshipTable} WHERE term_taxonomy_id = {$tax_id}"), ARRAY_A);
                    if (!empty($post_ids)) {
                        foreach ($post_ids as $key => $object_id) {
                            $ids .= " {$PostsTable}.ID = " . $object_id['object_id'] . ' OR';
                        }
                    }
                }
            }
            if ($ids) {
                $ids = ' AND  (' . substr($ids, 0, strlen($ids) - 2) . ')';
            } else {
                if ($taxonomy) {
                    $ids = ' AND  ID=null';
                }
            }
            /* below is my updates */
            $order_by = "";
            $aorder = array();
            $aorder1 = array();
            if ($order_post_by) {
                $tab_order_by1 = explode(" ", $order_post_by);
                if (($tab_order_by1[0] == "page_order" || $tab_order_by1[0] == "alphabetical_order" || $tab_order_by1[0] == "date_order") && (trim($tab_order_by1[1]) == "" || strtoupper($tab_order_by1[1]) == "DESC" || strtoupper($tab_order_by1[1]) == "ASC")) {
                    $order_by .= " ORDER BY " . $PostsTable . "." . $order_post_by;
                    $ordad = $tab_order_by1[1] ? $tab_order_by1[1] : "ASC";
                    $aorder = array_merge($aorder, array($tab_order_by1[0] => $ordad));
                    $ordad0 = "ID";
                    if ($tab_order_by1[0] == "date_order") {
                        $ordad0 = "post_date";
                    } else {
                        if ($tab_order_by1[0] == "alphabetical_order") {
                            $ordad0 = "post_title";
                        }
                    }
                    if (strtoupper($tab_order_by1[1]) == "DESC") {
                        $ordad1 = SORT_DESC;
                    } else {
                        $ordad1 = SORT_ASC;
                    }
                    $aorder1 = array_merge($aorder1, array($ordad0 => $ordad1));
                }
            }
            if ($random) {
                if ($page > 1 && $paginate) {
                    $the_post = $wpdb->get_results($wpdb->prepare("SELECT {$PostsTable}.ID, {$PostsTable}.post_title, {$PostsTable}.post_excerpt, {$PostsTable}.post_content, {$PostsTable}.post_author, {$PostsTable}.post_date, {$PostsTable}.guid, {$BlogsTable}.blog_id\n\t\t\t\t\t\tFROM {$PostsTable}, {$BlogsTable} WHERE {$BlogsTable}.blog_id  =  {$blog_id}  AND {$PostsTable}.post_status = %s {$ids}  AND {$PostsTable}.post_type = '{$post_type}'  {$old}  {$limit}", 'publish'), ARRAY_A);
                } else {
                    $the_post = $wpdb->get_results($wpdb->prepare("SELECT {$PostsTable}.ID, {$PostsTable}.post_title, {$PostsTable}.post_excerpt, {$PostsTable}.post_content, {$PostsTable}.post_author, {$PostsTable}.post_date, {$PostsTable}.guid, {$BlogsTable}.blog_id\n\t\t\t\t\t\tFROM {$PostsTable}, {$BlogsTable} WHERE {$BlogsTable}.blog_id  =  {$blog_id}  AND {$PostsTable}.post_status = %s {$ids}  AND {$PostsTable}.post_type = '{$post_type}'  {$old} ORDER BY RAND() {$limit}", 'publish'), ARRAY_A);
                }
            } else {
                $the_post = $wpdb->get_results($wpdb->prepare("SELECT {$PostsTable}.ID, {$PostsTable}.post_title, {$PostsTable}.post_excerpt, {$PostsTable}.post_content, {$PostsTable}.post_author, {$PostsTable}.post_date, {$PostsTable}.guid, {$BlogsTable}.blog_id\n\t\t\t\t\tFROM {$PostsTable}, {$BlogsTable} WHERE {$BlogsTable}.blog_id  =  {$blog_id}  AND {$PostsTable}.post_status = %s {$ids}  AND {$PostsTable}.post_type = '{$post_type}'  {$old}    {$limit}", 'publish'), ARRAY_A);
            }
            /* my updates are finished here */
            $postdata = array_merge_recursive($postdata, $the_post);
            $ids = '';
        }
    }
    /* below is my updates */
    if (!$random) {
        if ($order_by == "") {
            usort($postdata, "custom_sort");
        } else {
            $postdata = array_msort($postdata, $aorder1);
        }
    }
    /* my updates are finished here */
    /* below is my updates */
    $exclude_post2 = explode(",", $exclude_post);
    foreach ($exclude_post2 as $row) {
        $postdata = removeElementWithValue($postdata, "ID", $row);
    }
    /* my updates are finished here */
    if (isset($include_post)) {
        $include_post2 = explode(",", $include_post);
        foreach ($postdata as $postX) {
            if (in_array($postX['ID'], $include_post2)) {
                $newPostdata[] = $postX;
            }
        }
        $postdata = $newPostdata;
    }
    if ($paginate) {
        if ($column > 1) {
            $column_list = ceil($list / $column);
            $list = $column_list * $column;
            if (!$list) {
                $list = $column;
                $column_list = 1;
            }
        }
        $page = get_query_var('paged');
        if (!$page) {
            $page = get_query_var('page');
        }
        if (!$page) {
            $page = 1;
        }
        /* below is my updates */
        //$postdata = super_unique($postdata,"ID");
        /* my updates are finished here */
        /* below is my updates */
        /*$exclude_post2 = explode(",",$exclude_post);
        
                foreach($exclude_post2 as $row){
        
                    $postdata = removeElementWithValue($postdata, "ID", $row);
        
                }*/
        /* my updates are finished here */
        //if(!in_array($the_post['ID'], $exclude_post2)){
        $total_records = count($postdata);
        $total_pages = ceil($total_records / $list);
        $postdata = array_slice($postdata, ($page - 1) * $list, $list);
    } else {
        $postdata = array_slice($postdata, 0, $list);
    }
    /* my updates are finished here */
    if ($column > 1) {
        $count = count($postdata);
        if (!$paginate) {
            $column_list = ceil($count / $column);
        }
        for ($i = 0; $i < $column; ++$i) {
            if ($count < $column_list * $column) {
                $column_list = ceil($count / $column);
            }
            $colomn_data[$i] = array_slice($postdata, $i * $column_list, $column_list);
        }
    } else {
        $colomn_data[0] = $postdata;
    }
    ## OUTPUT
    if ($page_title_style) {
        ?>
	
	<style type="text/css">
	h2.pagetitle
	{
        <?php 
        echo $page_title_style;
        ?>
        <?php 
        echo get_option('net-style');
        ?>
	}
	</style>
	<?php 
    }
    $html = '<div id="netsposts-menu">';
    if ($menu_name) {
        $menu = array('menu' => $menu_name, 'menu_class' => $menu_class, 'container_class' => $container_class);
        wp_nav_menu($menu);
    }
    $html .= '</div>';
    if ($postdata) {
        $html .= "<style>";
        $html .= get_option('net-style');
        $html .= "</style>";
        $html .= '<div id="block-wrapper">';
        if (isset($post_height)) {
            $height_content = "height: " . $post_height . "px;";
        } else {
            $height_content = "";
        }
        if ($title) {
            $html .= '<span class="netsposts-title">' . $title . '</span><br />';
        }
        foreach ($colomn_data as $data) {
            if ($column > 1) {
                $html .= '<div class ="netsposts-column" style="width: ' . $column_width . 'px;">';
            }
            foreach ($data as $key => $the_post) {
                $blog_details = get_blog_details($the_post['blog_id']);
                $blog_name = $blog_details->blogname;
                $blog_url = $blog_details->siteurl;
                if ($titles_only) {
                    $title_class = 'netsposts-post-titles-only';
                } else {
                    $title_class = 'netsposts-posttitle';
                }
                $html .= html_entity_decode($wrap_start) . '<div class="netsposts-content" style="' . $height_content . '">';
                $html .= htmlspecialchars_decode($wrap_title_start);
                $html .= '<span class="' . $title_class . '" style="color: ' . $title_color . ';"><a href="' . $the_post['guid'] . '"> ' . ShortenText($the_post['post_title'], $title_length) . ' </a></span>';
                $html .= htmlspecialchars_decode($wrap_title_end);
                if (!$titles_only) {
                    $date = new DateTime(trim($the_post['post_date']));
                    $date_post = $date->format($date_format);
                    if ($meta_info != "false") {
                        if ($meta_width == "100%") {
                            $width = 'width: 100%;';
                        } else {
                            $width = "width: " . $meta_width . "px;";
                        }
                        $html .= '<span class="netsposts-source" style="height: 24px; margin-bottom: 5px; overflow: hidden; ' . $width . '"> ' . __('Published', 'netsposts') . ' ' . $date_post . ' ' . __('in', 'netsposts') . '  <a href="' . $blog_url . '">' . $blog_name . '</a>';
                    }
                    ##  Full metadata
                    if ($show_author) {
                        if ($column > 1) {
                            $html .= '<br />';
                        }
                        $html .= ' ' . __('Author', 'netsposts') . ' ' . '<a href="' . $blog_url . '?author=' . $the_post['post_author'] . '">' . get_the_author_meta('display_name', $the_post['post_author']) . ' </a>';
                    }
                    $html .= '</span>';
                    if ($thumbnail) {
                        $html .= htmlspecialchars_decode($wrap_image_start);
                        $html .= '<a href="' . $the_post['guid'] . '">' . get_thumbnail_by_blog($the_post['blog_id'], $the_post['ID'], $size, $image_class, $column) . '</a>';
                        $html .= htmlspecialchars_decode($wrap_image_end);
                        $html .= htmlspecialchars_decode($wrap_text_start);
                        $html .= '<p class="netsposts-excerpt" style="color: ' . $text_color . ';">';
                        $the_post['post_content'] = preg_replace("/<img[^>]+\\>/i", "", $the_post['post_content']);
                    }
                    if ($auto_excerpt) {
                        $exerpt = get_excerpt($excerpt_length, $the_post['post_content'], $the_post['guid']);
                    } else {
                        $exerpt = $the_post['post_excerpt'];
                    }
                    if ($full_text) {
                        $text = $the_post['post_content'];
                    } else {
                        if ($manual_excerpt_length) {
                            $text = get_excerpt($manual_excerpt_length, $exerpt, $the_post['guid']);
                        } else {
                            $text = $exerpt;
                        }
                    }
                    $html .= strip_shortcodes($text);
                    $html .= ' <a class="netsposts-read-more-link" href="' . $the_post['guid'] . '">read more&rarr;</a></p>';
                    $html .= htmlspecialchars_decode($wrap_text_end);
                }
                $html .= "</div>";
                $html .= "";
                $html .= html_entity_decode($wrap_end);
                $html .= "";
            }
            if ($column > 1) {
                $html .= '</div>';
            }
        }
        $html .= '<div class="clear"></div>';
        if ($paginate and $total_pages > 1) {
            $html .= '<div id="netsposts-paginate">';
            $big = 999999999;
            $html .= paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => $page, 'total' => $total_pages, 'prev_text' => __($prev), 'next_text' => __($next), 'end_size' => $end_size, 'mid_size' => $mid_size));
            $html .= '</div>';
        }
        $html .= '</div>';
    }
    return $html;
}
示例#7
0
文件: utility.php 项目: h3rb/page
 function AZSort($arr, $colname, $renumber = FALSE)
 {
     $sorted = array_msort($arr, array($colname => SORT_ASC));
     if ($renumber !== FALSE) {
         return renumber($sorted);
     }
     return $sorted;
 }