Plugin Directory

Changeset 526288


Ignore:
Timestamp:
04/02/2012 03:43:43 PM (14 years ago)
Author:
pr4ka5a
Message:

adding shortcode support

Location:
wp-frontlinesms/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-frontlinesms/trunk/frontlinesms.php

    r492504 r526288  
    3939
    4040add_action('admin_menu', 'frontlinesms_admin_menu');
     41add_shortcode("wp-frontlinesms","laman_flsms");
    4142
    4243//to retrieve from message database
    43 function ambil()
     44function ambil($bbawah,$batas)
    4445{
    4546    global $wpdb;
    4647    $table = $wpdb->prefix."frontlinesms";
    47     $results = $wpdb->get_results("SELECT sender_number, message_content FROM $table ORDER BY dt DESC LIMIT 5",ARRAY_N);
     48    $results = $wpdb->get_results("SELECT sender_number, message_content FROM $table ORDER BY dt DESC limit $bbawah,$batas ",ARRAY_N);
     49   /* 
    4850    for($i=1; $i<count($results); $i++)
    4951    {
    50         echo $results[$i][0]." --> ".$results[$i][1]."<br>";
    51     }
     52        echo $results[$i][0]." : ".$results[$i][1]."<br>";
     53    }
     54   */
     55    return $results;
    5256
    5357}
    5458
     59function penghalaman(){
     60    $hal = ambil();
     61}
     62/********************************
     63    Widget WP-FrontlineSMS
     64*/
     65function samping_flsms(){
     66    $test = ambil(0,5);
     67       
     68     for($i=1; $i<count($test); $i++)
     69    {
     70       echo $test[$i][0]." : ".$test[$i][1]."<hr />";
     71    }
     72}
    5573
    56 //Widget plugins sidebar
     74/*********************************
     75    Shortcode WP-FrontlineSMS
     76*/
     77function laman_flsms(){
     78    $perhal = 5;
     79    $nomhal = 1;   
     80    global $wpdb;
     81        $table = $wpdb->prefix."frontlinesms";
     82        $results = $wpdb->get_results("SELECT COUNT(sender_number) AS jumbar FROM $table",ARRAY_A);
     83    $tothal = ceil($results[0]['jumbar']/$perhal);
     84    if(isset($_GET['page']))
     85        {
     86            $nomhal = $_GET['page'];
     87        }
     88    $offset = ($nomhal - 1) * $perhal;
     89    $test = ambil($offset,$perhal);
     90    for($i=1; $i<count($test); $i++)
     91        {
     92           echo 'SMS Dari '.$test[$i][0]." : ".$test[$i][1]."<hr />";
     93        }
    5794
    58 error_reporting(E_ALL);
     95        $self = $_SERVER['PHP_SELF'];
     96    $nav  = '';
     97
     98    for($page = 1; $page <= $tothal; $page++)
     99    {
     100       if ($page == $nomhal)
     101       {
     102          $nav .= " $page "; // no need to create a link to current page
     103       }
     104       else
     105       {
     106          $nav .= " <a href=\"$self?page=$page\">$page</a> ";
     107       }
     108    }
     109    echo $nav;
     110}
     111
     112/****************************
     113    Widget plugins sidebar
     114*/
     115//error_reporting(E_ALL);
    59116add_action("widgets_init", array('FrontlineSMS_widget', 'register'));
    60117class FrontlineSMS_widget {
     
    65122                echo $args['before_widget'];
    66123                echo $args['before_title'] . 'SMS Message' . $args['after_title'];
    67                 echo ambil();
     124                echo samping_flsms();
    68125                echo $args['after_widget'];
    69126                      }
     
    106163                            $wpdb->query($wpdb->prepare($send, $kk, $ss, $mm));
    107164                            */
    108                         $wpdb->insert($table, array('FRONTLINE_key' => $kk,
    109                                                         'sender_number' => $ss,
    110                                                                        'message_content' => $mm,
    111                                                                                         'dt' => $dt ));
     165                        $wpdb->insert($table, array('FRONTLINE_key' => $kk, 'sender_number' => $ss,'message_content' => $mm, 'dt' => $dt ));
    112166                                                                                            $wpdb->show_errors();
    113167                                                                                         
  • wp-frontlinesms/trunk/frontlinesms_admin.php

    r492504 r526288  
    3333<br />
    3434<?
    35 echo "<b> http://" . $_SERVER['HTTP_HOST'] . "/index.php?ss=\${sender_number}&mm=\${message_content}&kk= </b>";
     35echo "<b> http://" . $_SERVER['HTTP_HOST'] . "/index.php?ss=\${sender_number}&mm=\${message_content}&kk=</b>";
    3636echo "<b>" . check_frontlinesms_key() . "</b><br />";
    3737echo "Just fill the link above to the frontlineSMS external command Http Request";
  • wp-frontlinesms/trunk/readme.txt

    r487374 r526288  
    22221. Upload `wp-frontlinesms` directory to the `/wp-content/plugins/` directory
    23232. Activate the plugin through the 'Plugins' menu in WordPress
    24 3. Place widget to the bar
     243. Place widget to the bar or adding shortcode [wp-frontlinesms] to a Post or Page
    2525
    2626== Frequently Asked Questions ==
     
    5656= 0.2=
    5757* fixing link in admin page
     58
     59= 0.3 =
     60* Adding Shortcode [wp-frontlinesms]
     61* Pagination on message displayed with the short code
     62* Change the "-->" to ":"
    5863
    5964== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.