コード例 #1
0
 public function reverseTransform($value)
 {
     if (is_Array($value)) {
         return $value;
     }
     return array_map('trim', explode(',', $value));
 }
コード例 #2
0
ファイル: Twitter.php プロジェクト: krsreenatha/php.ug
 /**
  * Search users
  *
  * $options may include any of the following:
  * - page: the page of results to retrieve
  * - count: the number of users to retrieve per page; max is 20
  * - include_entities: if set to boolean true, include embedded entities
  *
  * @param  string $query
  * @param  array $options
  * @throws Http\Client\Exception\ExceptionInterface if HTTP request fails or times out
  * @throws Exception\DomainException if unable to decode JSON payload
  * @return Response
  */
 public function usersLookup($query, array $options = array())
 {
     $this->init();
     $path = 'users/lookup';
     if (is_Array($query)) {
         $query = implode(',', $query);
     }
     $len = iconv_strlen($query, 'UTF-8');
     if (0 == $len) {
         throw new \ZendService\Twitter\Exception\InvalidArgumentException('Query must contain at least one character');
     }
     $params = array('screen_name' => $query);
     foreach ($options as $key => $value) {
         switch (strtolower($key)) {
             case 'count':
                 $value = (int) $value;
                 if (1 > $value || 20 < $value) {
                     throw new Exception\InvalidArgumentException('count must be between 1 and 20');
                 }
                 $params['count'] = $value;
                 break;
             case 'page':
                 $params['page'] = (int) $value;
                 break;
             case 'include_entities':
                 $params['include_entities'] = (bool) $value;
                 break;
             default:
                 break;
         }
     }
     $response = $this->get($path, $params);
     return new \ZendService\Twitter\Response($response);
 }
コード例 #3
0
    function pmpro_levels($course_id = null)
    {
        if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && function_exists('pmpro_getAllLevels')) {
            $levels = pmpro_getAllLevels();
            // Get all the PMPro Levels
            ?>
          <li class="course_membership"><strong><?php 
            _e('Set Course Memberships', 'wplms-front-end');
            ?>
<span>
                  <select id="vibe_pmpro_membership" class="chosen" multiple>
                      <?php 
            if (isset($levels) && is_array($levels)) {
                foreach ($levels as $level) {
                    if (!is_Array($course_pricing['vibe_pmpro_membership'])) {
                        $course_pricing['vibe_pmpro_membership'] = array();
                    }
                    if (is_object($level)) {
                        echo '<option value="' . $level->id . '" ' . (in_array($level->id, $course_pricing['vibe_pmpro_membership']) ? 'selected' : '') . '>' . $level->name . '</option>';
                    }
                }
            }
            ?>
                  </select>
              </span>
              </strong>
          </li>
      <?php 
        }
    }
コード例 #4
0
ファイル: ProjectTest.php プロジェクト: nashant/trackstar
 public function testGetUserOptions()
 {
     $project = $this->projects('project1');
     $options = $project->getUserOptions();
     $this->assertTrue(is_Array($options));
     $this->assertTrue(count($options) > 0);
 }
コード例 #5
0
ファイル: SCV2_LibPHP.php プロジェクト: seans888/APC-CPO
function scriptCheckIfNull()
{
    $errMsg = "";
    $numargs = func_num_args();
    for ($cntr = 0; $cntr < $numargs; $cntr += 2) {
        //Create keys for the label-value pair. First in the pair is the label of the field,
        //followed by the value that was submitted for that field.
        $key1 = $cntr;
        $key2 = $cntr + 1;
        $label = func_get_arg($key1);
        //This gets the label that was passed.
        $value = func_get_arg($key2);
        //This gets the value that was passed.
        if (!is_Array($value)) {
            if ($value == "") {
                $errMsg .= "No value detected: {$label} <BR>";
            }
        } else {
            $elements = count($value);
            for ($arrCnt = 0; $arrCnt < $elements; $arrCnt++) {
                if ($value[$arrCnt] == '') {
                    $errMsg .= "No value detected: {$label} in Line #" . ($arrCnt + 1) . ".<BR>";
                }
            }
        }
    }
    return $errMsg;
}
コード例 #6
0
ファイル: basic.php プロジェクト: Prescia/Prescia
function print_ro($object, $alsoIgnore = array(), $tab = 0)
{
    // prints an object/array, but removes the $parent, and anything inside alsoIgnore
    $pad = "";
    if (!in_array('parent', $alsoIgnore)) {
        $alsoIgnore[] = "parent";
    }
    for ($c = 0; $c < $tab; $c++) {
        $pad .= "\t";
    }
    foreach ($object as $key => $value) {
        if (!is_numeric($key) && in_array($key, $alsoIgnore)) {
            echo $pad . $key . " => *HIDDEN*\n";
        } else {
            if (is_Array($value) || is_Object($value)) {
                if (is_Array($value)) {
                    echo "{$pad}{$key} => Array (\n";
                } else {
                    echo "{$pad}{$key} => Object (\n";
                }
                print_ro($value, $alsoIgnore, $tab + 1);
                echo $pad . ")\n";
            } else {
                echo $pad . $key . " => " . $value . "\n";
            }
        }
    }
}
コード例 #7
0
ファイル: ipnurl.php プロジェクト: juanmcortez/Lectorum
 function fetchElement($name, $value, &$node, $control_name)
 {
     $cid = vRequest::getvar('cid', NULL, 'array');
     if (is_Array($cid)) {
         $virtuemart_paymentmethod_id = $cid[0];
     } else {
         $virtuemart_paymentmethod_id = $cid;
     }
     $http = JURI::root() . 'index.php?option=com_virtuemart&view=vmplg&task=notify&nt=ipn&tmpl=component&pm=' . $virtuemart_paymentmethod_id;
     $https = str_replace('http://', 'https://', $http);
     $class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="text_area"';
     if ($node->attributes('editable') == 'true') {
         $size = $node->attributes('size') ? 'size="' . $node->attributes('size') . '"' : '';
         return '<input type="text" name="' . $control_name . '[' . $name . ']" id="' . $control_name . $name . '" value="' . $value . '" ' . $class . ' ' . $size . ' />';
     } else {
         $string = "<div " . $class . ">";
         $string .= '<div class="ipn-sandbox">' . $http . ' <br /></div>';
         if (strcmp($https, $http) !== 0) {
             $string .= '<div class="ipn-sandbox">' . vmText::_('VMPAYMENT_AMAZON_OR') . '<br /></div>';
             $string .= $https;
             $string .= "</div>";
         }
         return $string;
     }
 }
コード例 #8
0
 function check_if_null_new()
 {
     $this->error_message = '';
     $numargs = func_num_args();
     for ($cntr = 0; $cntr < $numargs; $cntr += 2) {
         //Create keys for the label-value pair. First in the pair is the label of the field,
         //followed by the value that was submitted for that field.
         $key1 = $cntr;
         $key2 = $cntr + 1;
         $label = func_get_arg($key1);
         //This gets the label that was passed.
         $value = func_get_arg($key2);
         //This gets the value that was passed.
         if (!is_Array($value)) {
             //if(trim($value)=="") $this->error_message .= "No value detected: $label <BR>";
             if (trim($value) == "") {
                 $this->error_message .= "This field is required.";
             }
         } else {
             $elements = count($value);
             for ($arrCnt = 0; $arrCnt < $elements; $arrCnt++) {
                 if ($value[$arrCnt] == '') {
                     $this->error_message .= "No value detected: {$label} in Line #" . ($arrCnt + 1) . ".<BR>";
                 }
             }
         }
     }
     return $this->error_message;
 }
コード例 #9
0
 /**
  * Create code frame for compiled and cached templates
  *
  * @param Smarty_Internal_Template $_template
  * @param  string                  $content optional template content
  * @param  bool                    $cache   flag for cache file
  *
  * @return string
  */
 public static function create(Smarty_Internal_Template $_template, $content = '', $cache = false)
 {
     // build property code
     $properties['has_nocache_code'] = $_template->compiled->has_nocache_code;
     $properties['version'] = Smarty::SMARTY_VERSION;
     $properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
     if (!empty($_template->tpl_function)) {
         $properties['tpl_function'] = $_template->tpl_function;
     }
     if (!$cache) {
         $properties['file_dependency'] = $_template->compiled->file_dependency;
         $properties['includes'] = $_template->compiled->includes;
     } else {
         $properties['file_dependency'] = $_template->cached->file_dependency;
         $properties['cache_lifetime'] = $_template->cache_lifetime;
     }
     $output = "<?php\n";
     $output .= "/*%%SmartyHeaderCode:{$_template->compiled->nocache_hash}%%*/\n";
     if ($_template->smarty->direct_access_security) {
         $output .= "if(!defined('SMARTY_DIR')) exit('no direct access allowed');\n";
     }
     $output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($properties, true) . ',' . ($cache ? 'true' : 'false') . ");\n";
     $output .= "/*/%%SmartyHeaderCode%%*/\n";
     $output .= "if (\$_valid && !is_callable('{$properties['unifunc']}')) {\n";
     $output .= "function {$properties['unifunc']} (\$_smarty_tpl) {\n";
     // include code for plugins
     if (!$cache) {
         if (!empty($_template->compiled->required_plugins['compiled'])) {
             foreach ($_template->compiled->required_plugins['compiled'] as $tmp) {
                 foreach ($tmp as $data) {
                     $file = addslashes($data['file']);
                     if (is_array($data['function'])) {
                         $output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n";
                     } else {
                         $output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n";
                     }
                 }
             }
         }
         if ($_template->caching && !empty($_template->compiled->required_plugins['nocache'])) {
             $_template->compiled->has_nocache_code = true;
             $output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/<?php \$_smarty = \$_smarty_tpl->smarty; ";
             foreach ($_template->compiled->required_plugins['nocache'] as $tmp) {
                 foreach ($tmp as $data) {
                     $file = addslashes($data['file']);
                     if (is_Array($data['function'])) {
                         $output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n");
                     } else {
                         $output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n");
                     }
                 }
             }
             $output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n";
         }
     }
     $output .= "?>\n";
     $output = self::appendCode($output, $content);
     return self::appendCode($output, "<?php }\n}\n?>");
 }
コード例 #10
0
 /**
  * Create code frame for compiled and cached templates
  *
  * @param Smarty_Internal_Template $_template
  * @param  string                  $content optional template content
  * @param  bool                    $cache   flag for cache file
  *
  * @return string
  */
 public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false)
 {
     // build property code
     $properties['has_nocache_code'] = $_template->compiled->has_nocache_code;
     $properties['version'] = Smarty::SMARTY_VERSION;
     $properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
     if (!empty($_template->tpl_function)) {
         $properties['tpl_function'] = $_template->tpl_function;
     }
     if (!$cache) {
         $properties['file_dependency'] = $_template->compiled->file_dependency;
         $properties['includes'] = $_template->compiled->includes;
     } else {
         $properties['file_dependency'] = $_template->cached->file_dependency;
         $properties['cache_lifetime'] = $_template->cache_lifetime;
     }
     $output = "<?php\n";
     $output .= "/* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n  from \"" . $_template->source->filepath . "\" */\n\n";
     $dec = "\$_smarty_tpl->smarty->ext->_validateCompiled->decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' . ($cache ? 'true' : 'false') . ")";
     $output .= "if ({$dec}) {\n";
     $output .= "function {$properties['unifunc']} (\$_smarty_tpl) {\n";
     // include code for plugins
     if (!$cache) {
         if (!empty($_template->compiled->required_plugins['compiled'])) {
             foreach ($_template->compiled->required_plugins['compiled'] as $tmp) {
                 foreach ($tmp as $data) {
                     $file = addslashes($data['file']);
                     if (is_array($data['function'])) {
                         $output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n";
                     } else {
                         $output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n";
                     }
                 }
             }
         }
         if ($_template->caching && !empty($_template->compiled->required_plugins['nocache'])) {
             $_template->compiled->has_nocache_code = true;
             $output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/<?php \$_smarty = \$_smarty_tpl->smarty; ";
             foreach ($_template->compiled->required_plugins['nocache'] as $tmp) {
                 foreach ($tmp as $data) {
                     $file = addslashes($data['file']);
                     if (is_Array($data['function'])) {
                         $output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n");
                     } else {
                         $output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n");
                     }
                 }
             }
             $output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n";
         }
     }
     $output .= "?>\n";
     $output .= $content;
     $output .= "<?php }\n?>";
     $output .= $functions;
     $output .= "<?php }\n";
     // remove unneeded PHP tags
     return preg_replace('/\\s*\\?>[\\n]?<\\?php\\s*/', "\n", $output);
 }
コード例 #11
0
function get_cached($uri)
{
    $uri = addslashes($uri);
    $r = mysql_fetch_all(mysql_query("SELECT * FROM cache WHERE uri = '{$uri}'"));
    if (is_Array($r)) {
        return array_shift($r);
    }
}
コード例 #12
0
function login($username, $password)
{
    session_regenerate_id(true);
    $file = "/home/fcocco01/private/users.php";
    $linesOfFile = readFileChosen($file);
    //set variables
    $all_correct = FALSE;
    $username_correct = FALSE;
    $password_correct = FALSE;
    $username_login_trimmed = trim(filter_var($username, FILTER_SANITIZE_STRING));
    $password_login_trimmed = trim(filter_var($password, FILTER_SANITIZE_STRING));
    if (!empty($username) || !empty($password)) {
        //Foreach loop to take each line of the array
        foreach ($linesOfFile as $line) {
            //Exclude empty lines from loop
            if (!($line == "") || !is_bool($line)) {
                //Parse each line into array of elements
                $details = explode(',', $line);
                //Stores, trims and sanitizes input from the user
                //checks if the array exists and assign variables from indexed values
                if (isset($details) && is_Array($details)) {
                    $details_username = reset($details);
                    $details_password = trim(end($details));
                    //compares values with input. If they do not match or input is empty, gives out error
                    if ($username_login_trimmed === $details_username && $password_login_trimmed === $details_password) {
                        $all_correct = TRUE;
                        break;
                    } else {
                        if ($username_login_trimmed === $details_username) {
                            $username_correct = TRUE;
                        }
                    }
                }
            }
        }
    }
    //returns arrays depending which condition is satisfied
    //the details are both correct
    if ($all_correct) {
        session_regenerate_id(true);
        return array('TheUsername' => $username_login_trimmed, 'ThePassword' => $password_login_trimmed);
    } else {
        //one or more detail was wrong or left empty
        if (!$username_correct) {
            $error_messages_login['username_error'] = "username is incorrect";
        }
        if ($username_correct) {
            $error_messages_login['password_error'] = "password is incorrect";
        }
        if (empty($username)) {
            $error_messages_login['username_error'] = "please insert a valid username";
        }
        if (empty($password)) {
            $error_messages_login['password_error'] = "please insert your password";
        }
        return $error_messages_login;
    }
}
コード例 #13
0
ファイル: getpaybox.php プロジェクト: lenard112/cms
    function getInput()
    {
        $js = '
//<![CDATA[
		jQuery(document).ready(function( $ ) {

		    jQuery("#paybox_getpaybox_link").click( function() {
				 if ( $("#paybox_getpaybox_show_hide").is(":visible") ) {
				  $("#paybox_getpaybox_show_hide").hide("slow");
			        $("#paybox_getpaybox_link").html("' . addslashes(vmText::_('VMPAYMENT_PAYBOX_ALREADY_ACCOUNT')) . '");
				} else {
				 $("#paybox_getpaybox_show_hide").show("slow");
			       $("#paybox_getpaybox_link").html("' . addslashes(vmText::_('VMPAYMENT_PAYBOX_GET_PAYBOX_HIDE')) . '");
			    }
		    });
		});
//]]>
';
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        if (!class_exists('pbxRequest')) {
            require JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'paybox' . DS . 'paybox' . DS . 'helpers' . DS . 'pbxrequest.php';
        }
        $cid = pbxRequest::getvar('cid', NULL, 'array');
        if (is_Array($cid)) {
            $virtuemart_paymentmethod_id = $cid[0];
        } else {
            $virtuemart_paymentmethod_id = $cid;
        }
        $query = "SELECT * FROM `#__virtuemart_paymentmethods` WHERE  virtuemart_paymentmethod_id = '" . $virtuemart_paymentmethod_id . "'";
        $db = JFactory::getDBO();
        $db->setQuery($query);
        $params = $db->loadObject();
        $html = '<img src="http://virtuemart.boutique-paybox.com/PayboxLogo.jpg" width="200px"/><br />';
        if ($params->created_on == $params->modified_on) {
            $id = "paybox_getpaybox_link";
            $html .= '<a href="#" id="' . $id . '">' . vmText::_('VMPAYMENT_PAYBOX_GET_PAYBOX_HIDE') . '</a>';
            $display = '';
            $html .= '<div id="paybox_getpaybox_show_hide" align=""' . $display . ' >';
        } else {
            $id = "paybox_getpaybox_link";
            $html .= '<a href="#" id="' . $id . '">' . vmText::_('VMPAYMENT_PAYBOX_ALREADY_ACCOUNT') . '</a>';
            $display = ' style="display: none;"';
            $html .= '<div id="paybox_getpaybox_show_hide" align=""' . $display . ' >';
        }
        $id = "";
        $lang = $this->getLang();
        if ($lang == 'fr') {
            $url = "http://virtuemart.boutique-paybox.com/PayboxPres.html";
        } else {
            $url = "http://virtuemart.boutique-paybox.com/PayboxPres.html";
        }
        $html .= '<iframe src="' . $url . '" scrolling="yes" style="x-overflow: none;" frameborder="0" height="1400px" width="800px"></iframe>';
        $html .= "</div>";
        return $html;
    }
コード例 #14
0
ファイル: getheidelpay.php プロジェクト: juanmcortez/Lectorum
    function fetchElement($name, $value, &$node, $control_name)
    {
        $js = '
//<![CDATA[
		jQuery(document).ready(function( $ ) {

		    jQuery("#heidelpay_getheidelpay_link").click( function() {
				 if ( $("#heidelpay_getheidelpay_show_hide").is(":visible") ) {
				  $("#heidelpay_getheidelpay_show_hide").hide("slow");
			        $("#heidelpay_getheidelpay_link").html("' . addslashes(JText::_('VMPAYMENT_HEIDELPAY_CREATE_ACCOUNT')) . '");
				} else {
				 $("#heidelpay_getheidelpay_show_hide").show("slow");
			       $("#heidelpay_getheidelpay_link").html("' . addslashes(JText::_('VMPAYMENT_HEIDELPAY_GET_HEIDELPAY_HIDE')) . '");
			    }
		    });
		});
//]]>
';
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        $cid = jrequest::getvar('cid', NULL, 'array');
        if (is_Array($cid)) {
            $virtuemart_paymentmethod_id = $cid[0];
        } else {
            $virtuemart_paymentmethod_id = $cid;
        }
        $query = "SELECT payment_params FROM `#__virtuemart_paymentmethods` WHERE  virtuemart_paymentmethod_id = '" . $virtuemart_paymentmethod_id . "'";
        $db = JFactory::getDBO();
        $db->setQuery($query);
        $params = $db->loadResult();
        $payment_params = explode("|", $params);
        foreach ($payment_params as $payment_param) {
            if (empty($payment_param)) {
                continue;
            }
            $param = explode('=', $payment_param);
            $payment_params[$param[0]] = substr($param[1], 1, -1);
        }
        $id = "";
        if ($payment_params['HEIDELPAY_SECURITY_SENDER'] == '31HA07BC8124AD82A9E96D9A35FAFD2A' or $payment_params['HEIDELPAY_SECURITY_SENDER'] == '') {
            $id = "heidelpay_getheidelpay_link";
            $display = '';
            $html = '<a href="#" id="' . $id . '" class="signin-button-link">' . JText::_('VMPAYMENT_HEIDELPAY_ALREADY_ACCOUNT') . '</a>';
        } else {
            $id = "heidelpay_getheidelpay_link";
            $display = ' style="display: none;"';
            $html = '<a href="#" id="' . $id . '" class="signin-button-link">' . JText::_('VMPAYMENT_HEIDELPAY_CREATE_ACCOUNT') . '</a>';
        }
        $lang = $this->getLang();
        $html .= '<div id="heidelpay_getheidelpay_show_hide" align=""' . $display . '  >';
        $url = "http://demoshops.heidelpay.de/contactform/?campaign=vituemart&shop=vituemart&lang=" . $lang;
        $html .= '<iframe src="' . $url . '" scrolling="yes" style="x-overflow: none;" frameborder="0" height="1400px" width="300px"></iframe>';
        $html .= "</div>";
        $html .= '<a target="_blank" href="http://docs.virtuemart.net/manual/shop-menu/payment-methods/heidelpay.html"  class="signin-button-link">' . vmText::_('VMPAYMENT_AMAZON_DOCUMENTATION') . '</a></p></div>';
        return $html;
    }
コード例 #15
0
 function get_order_report_data($start_date, $end_date)
 {
     global $wpdb;
     $order_item_meta_table = $wpdb->prefix . 'woocommerce_order_itemmeta';
     $order_items_table = $wpdb->prefix . 'woocommerce_order_items';
     $inst_commissions = $wpdb->get_results("SELECT order_items.order_id,order_meta.meta_key as instructor,order_meta.meta_value as commission\n\t\t\tFROM {$wpdb->posts} as posts\n\t\t\tLEFT JOIN {$order_items_table} as order_items ON posts.ID = order_items.order_id\n\t\t\tLEFT JOIN {$order_item_meta_table} as order_meta ON order_items.order_item_id = order_meta.order_item_id\n\t\t\tWHERE posts.post_type='shop_order'\n\t\t\tAND posts.post_status='wc-completed'\n\t\t\tAND posts.post_date BETWEEN '{$start_date}' AND '{$end_date}'\n\t\t\tAND order_meta.meta_key LIKE 'commission%'");
     if (is_array($inst_commissions)) {
         foreach ($inst_commissions as $inst_commission) {
             $order_ids[] = $inst_commission->order_id;
             $inst = explode('commission', $inst_commission->instructor);
             if (is_numeric($inst[1])) {
                 $instructor_commissions[$inst[1]] += $inst_commission->commission;
             }
         }
         if (is_array($order_ids)) {
             $order_id_string = implode(',', $order_ids);
         }
     }
     $query = "SELECT order_items.order_item_id,order_meta.meta_value as total_sales\n\t\t\tFROM {$wpdb->posts} as posts\n\t\t\tLEFT JOIN {$order_items_table} as order_items ON posts.ID = order_items.order_id\n\t\t\tLEFT JOIN {$order_item_meta_table} as order_meta ON order_items.order_item_id = order_meta.order_item_id\n\t\t\tWHERE posts.post_type='shop_order'\n\t\t\tAND posts.post_status='wc-completed'\n\t\t\tAND posts.post_date BETWEEN '{$start_date}' AND '{$end_date}'\n\t\t\tAND order_meta.meta_key = '_line_total'";
     if (isset($order_id_string)) {
         $query .= "AND posts.ID NOT IN ({$order_id_string})";
     }
     $inst_commissions = $wpdb->get_results($query);
     $commissions = get_option('instructor_commissions');
     foreach ($inst_commissions as $inst_commission) {
         $oid = $inst_commission->order_item_id;
         $pid = woocommerce_get_order_item_meta($oid, '_product_id', true);
         $courses = vibe_sanitize(get_post_meta($pid, 'vibe_courses', false));
         if (isset($courses) && is_array($courses) && count($courses)) {
             $n = count($courses);
             foreach ($courses as $course) {
                 $instructors = apply_filters('wplms_course_instructors', get_post_field('post_author', $course), $course);
                 if (is_numeric($instructors)) {
                     if (!isset($commission[$course][$instructors])) {
                         $commission[$course][$instructors] = 70;
                     }
                     echo $commission[$course][$instructors] * $inst_commission->total_sales;
                     $instructor_commissions[$instructors] += $commission[$course][$instructors] * $inst_commission->total_sales;
                 } else {
                     if (is_Array($instructors)) {
                         $k = count($instructors);
                         foreach ($instructors as $instructor) {
                             if (!isset($commission[$course][$instructor])) {
                                 $commission[$course][$instructor] = floor(70 / $k);
                             }
                             $instructor_commissions[$instructor] += $commission[$course][$instructor] * $inst_commission->total_sales;
                         }
                     }
                 }
             }
         }
     }
     return $instructor_commissions;
 }
コード例 #16
0
 public function __hasStatus()
 {
     $output = '';
     $terms = wp_get_post_terms($this->post->ID, 'property_status');
     if (is_Array($terms)) {
         foreach ($terms as $term) {
             $output = $term->name;
         }
     }
     return $output != '' ? $output : '';
 }
コード例 #17
0
ファイル: getpaybox.php プロジェクト: cuongnd/etravelservice
    function getInput()
    {
        $js = '
//<![CDATA[
		jQuery(document).ready(function( $ ) {

		    jQuery("#paybox_getpaybox_link").click( function() {
				 if ( $("#paybox_getpaybox_show_hide").is(":visible") ) {
				  $("#paybox_getpaybox_show_hide").hide("slow");
			        $("#paybox_getpaybox_link").html("' . addslashes(tsmText::_('VMPAYMENT_PAYBOX_ALREADY_ACCOUNT')) . '");
				} else {
				 $("#paybox_getpaybox_show_hide").show("slow");
			       $("#paybox_getpaybox_link").html("' . addslashes(tsmText::_('VMPAYMENT_PAYBOX_GET_PAYBOX_HIDE')) . '");
			    }
		    });
		});
//]]>
';
        vmJsApi::addJScript("vm.getPaybox", $js);
        vmJsApi::addJScript('/plugins/vmpayment/paybox/paybox/assets/js/admin.js');
        vmJsApi::css('admin', 'plugins/vmpayment/paybox/paybox/assets/css/');
        $cid = vRequest::getvar('cid', NULL, 'array');
        if (is_Array($cid)) {
            $virtuemart_paymentmethod_id = $cid[0];
        } else {
            $virtuemart_paymentmethod_id = $cid;
        }
        $query = "SELECT * FROM `#__virtuemart_paymentmethods` WHERE  virtuemart_paymentmethod_id = '" . $virtuemart_paymentmethod_id . "'";
        $db = JFactory::getDBO();
        $db->setQuery($query);
        $params = $db->loadObject();
        $html = '<img src="http://tsmart.boutique-paybox.com/PayboxLogo.jpg" width="200px"/><br />';
        if ($params->created_on == $params->modified_on) {
            $id = "paybox_getpaybox_link";
            $html .= '<a href="#" id="' . $id . '">' . tsmText::_('VMPAYMENT_PAYBOX_GET_PAYBOX_HIDE') . '</a>';
            $display = '';
            $html .= '<div id="paybox_getpaybox_show_hide" align=""' . $display . ' >';
        } else {
            $id = "paybox_getpaybox_link";
            $html .= '<a href="#" id="' . $id . '">' . tsmText::_('VMPAYMENT_PAYBOX_ALREADY_ACCOUNT') . '</a>';
            $display = ' style="display: none;"';
            $html .= '<div id="paybox_getpaybox_show_hide" align=""' . $display . ' >';
        }
        $id = "";
        $lang = $this->getLang();
        if ($lang == 'fr') {
            $url = "http://tsmart.boutique-paybox.com/PayboxPres.html";
        } else {
            $url = "http://tsmart.boutique-paybox.com/PayboxPres.html";
        }
        $html .= '<iframe src="' . $url . '" scrolling="yes" style="x-overflow: none;" frameborder="0" height="1400px" width="800px"></iframe>';
        $html .= "</div>";
        return $html;
    }
コード例 #18
0
ファイル: whois.utils.php プロジェクト: mesingh/phpwhois
 function debugObject($obj, $indent = 0)
 {
     if (is_Array($obj)) {
         $return = '';
         foreach ($obj as $k => $v) {
             $return .= str_repeat('&nbsp;', $indent);
             $return .= $k . "->{$v}\n";
             $return .= $this->debugObject($v, $indent + 1);
         }
         return $return;
     }
 }
コード例 #19
0
ファイル: sendMail.ini.php プロジェクト: sjw-github/lib
 function sendSmtp()
 {
     // fix issue 308
     $this->mail = new PHPMailer();
     //$our_email = $this->getRandMailAccount();
     $this->mail->IsSMTP();
     // set mailer to use SMTP
     $this->mail->CharSet = $this->charset;
     $this->mail->Encoding = $this->encoding;
     //$this->mail->From = $our_email ;
     $this->mail->From = $this->from;
     $this->mail->FromName = $this->from_name;
     $this->mail->Host = $this->host;
     $this->mail->Port = $this->port;
     //default is 25, gmail is 465 or 587
     $this->mail->SMTPAuth = $this->smtpauth;
     //$this->mail->SMTPSecure = $this->secure;
     //$this->mail->Username = $our_email ;
     $this->mail->Username = $this->account;
     $this->mail->Password = $this->password;
     if (is_Array($this->to)) {
         foreach ($this->to as $tv) {
             if (preg_match("/^([_.0-9a-z-]+)@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,4}\$/i", $tv)) {
                 $this->mail->AddAddress($tv);
             }
         }
     } else {
         if (preg_match("/^([_.0-9a-z-]+)@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,4}\$/i", $this->to)) {
             $this->mail->AddAddress($this->to);
         }
     }
     if (is_Array($this->cc)) {
         foreach ($this->cc as $tv) {
             if (preg_match("/^([_.0-9a-z-]+)@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,4}\$/i", $tv)) {
                 $this->mail->AddCC($tv);
             }
         }
     } else {
         if (preg_match("/^([_.0-9a-z-]+)@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,4}\$/i", $this->cc)) {
             $this->mail->AddCC($this->cc);
         }
     }
     $this->mail->WordWrap = 50;
     $this->mail->Subject = $this->subject;
     $this->mail->Body = $this->body;
     $this->isHtml($this->ishtml);
     if (!$this->mail->Send()) {
         echo $this->mail->ErrorInfo;
         exit;
     }
 }
コード例 #20
0
ファイル: oseObject.php プロジェクト: kosmosby/medicine-prof
 function setParams($item, $params)
 {
     $itemParams = oseGetValue($item, 'params', '{}');
     $itemParams = oseJson::decode($itemParams);
     if (!is_Array($params)) {
         $params = (array) $params;
     }
     foreach ($params as $key => $value) {
         $itemParams = oseSetValue($itemParams, $key, $value);
     }
     $itemParams = oseJson::encode($itemParams);
     $item = oseSetValue($item, 'params', $itemParams);
     return $item;
 }
コード例 #21
0
 public function importValues($values)
 {
     if (is_Array($values)) {
         $this->nationalDeliveryInformation($values['100'], true);
         $items = $this->data;
         foreach ($items as $item) {
             if (array_key_exists($item->getTag(), $values)) {
                 $item->setValue($values[$item->getTag()]);
             }
         }
         $this->nationalDeliveryInformation($values['100'], false);
         $this->bereinigeWennExpressversand($values['750']);
     }
 }
コード例 #22
0
 protected function translate($templateValue, array $data)
 {
     $translated = $templateValue;
     if (preg_match('/{{(\\w+)}}/', $templateValue, $regs)) {
         $key = $regs[1];
         if (array_key_exists($key, $data) && !is_Array($data[$key])) {
             $translated = preg_replace('/{{(\\w+)}}/', $data[$key], $templateValue);
         } else {
             $this->logger->notice("Could not translate {$templateValue}", ['data-keys' => array_keys($data)]);
             $translated = null;
         }
     }
     return $translated;
 }
コード例 #23
0
 function debugObject($obj, $indent = 0)
 {
     if (is_Array($obj) || is_Object($obj)) {
         $return = '';
         while (list($k, $v) = each($obj)) {
             for ($i = 0; $i < $indent; $i++) {
                 $return .= '&nbsp;';
             }
             $return .= $k . "->{$v}\n";
             $return .= $this->debugObject($v, $indent + 1);
         }
         return $return;
     }
 }
コード例 #24
0
function vibe_customize($wp_customize)
{
    require_once dirname(__FILE__) . '/config.php';
    /*====================================================== */
    /*===================== SECTIONS ====================== */
    /*====================================================== */
    $i = 164;
    // Show sections after the WordPress default sections
    if (isset($vibe_customizer) && is_Array($vibe_customizer)) {
        foreach ($vibe_customizer['sections'] as $key => $value) {
            $wp_customize->add_section($key, array('title' => $value, 'priority' => $i));
            $i = $i + 4;
        }
    }
    /*====================================================== */
    /*================= SETTINGS & CONTROLS ================== */
    /*====================================================== */
    if (isset($vibe_customizer) && is_array($vibe_customizer)) {
        foreach ($vibe_customizer['controls'] as $section => $settings) {
            $i = 1;
            foreach ($settings as $control => $type) {
                $i = $i + 2;
                /*====== REGISTER SETTING =========*/
                $wp_customize->add_setting('vibe_customizer[' . $control . ']', array('label' => $type['label'], 'type' => 'option', 'capability' => 'edit_theme_options', 'default' => $type['default']));
                switch ($type['type']) {
                    case 'color':
                        $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control, array('label' => $type['label'], 'section' => $section, 'settings' => 'vibe_customizer[' . $control . ']', 'priority' => $i)));
                        break;
                    case 'image':
                        $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, $control, array('label' => $type['label'], 'section' => $section, 'settings' => 'vibe_customizer[' . $control . ']', 'priority' => $i)));
                        break;
                    case 'select':
                        $wp_customize->add_control($control, array('label' => $type['label'], 'section' => $section, 'settings' => 'vibe_customizer[' . $control . ']', 'priority' => $i, 'type' => 'select', 'choices' => $type['choices']));
                        break;
                    case 'text':
                        $wp_customize->add_control($control, array('label' => $type['label'], 'section' => $section, 'settings' => 'vibe_customizer[' . $control . ']', 'priority' => $i, 'type' => 'text'));
                        break;
                    case 'slider':
                        $wp_customize->add_control(new Vibe_Customize_Slider_Control($wp_customize, $control, array('label' => $type['label'], 'section' => $section, 'settings' => 'vibe_customizer[' . $control . ']', 'priority' => $i, 'type' => 'slider')));
                        break;
                    case 'textarea':
                        $wp_customize->add_control(new Vibe_Customize_Textarea_Control($wp_customize, $control, array('label' => $type['label'], 'section' => $section, 'settings' => 'vibe_customizer[' . $control . ']', 'priority' => $i, 'type' => 'textarea')));
                        break;
                }
            }
        }
    }
}
コード例 #25
0
ファイル: gamagicApi.ini.php プロジェクト: sjw-github/lib
 function printXml($arr)
 {
     header('Content-Type:   text/xml ');
     $dom = new DOMDocument('1.0', 'utf-8');
     $root = $dom->createElement('gamagic');
     $dom->appendChild($root);
     $no = 0;
     if (is_Array($arr)) {
         foreach ($arr as $ak => $av) {
             $el1 = $dom->createElement($ak, $av);
             $root->appendChild($el1);
             $no++;
         }
     }
     echo $dom->saveXML();
     exit;
 }
コード例 #26
0
ファイル: siteclass.php プロジェクト: Jonathonbyrd/Member-Pro
 /**
  * designed to set the permissions to access certain functions
  * @return bool
  */
 function setPermissions()
 {
     global $wp_roles, $wp_user_roles, $wpdb;
     $roleStructure = array();
     $role =& bTable::getInstance('roles', 'Table');
     $roles = $role->getList();
     if (is_Array($roles)) {
         foreach ($roles as $num => $value) {
             $roleStructure[$value['role']]['name'] = $value['display_name'];
             $roleStructure[$value['role']]['capabilities'] = $value['capabilities'];
         }
         //getting the old roles from the db
         $role_key = $wpdb->prefix . 'user_roles';
         $this->old_roles = get_option($role_key);
         //merging the old roles into the new roles
         $wp_user_roles = $this->old_roles + $roleStructure;
     }
 }
コード例 #27
0
 public function __construct(array $data, \QueryPath\DOMQuery $content)
 {
     $this->content = $content;
     $this->data = $data;
     if (array_key_exists('attributes', $data) && is_Array($data['attributes'])) {
         $this->attributes = $data['attributes'];
     }
     if (array_key_exists('tagName', $this->attributes)) {
         $this->tagName = $this->attributes['tagName'];
         unset($this->attributes['tagName']);
     }
     if (array_key_exists('tagName', $data)) {
         $this->tagName = $data['tagName'];
     }
     if (array_key_exists('id', $data)) {
         $this->id = $data['id'];
     }
 }
コード例 #28
0
ファイル: ipnurl.php プロジェクト: cybershocik/Darek
 protected function getInput()
 {
     $cid = vRequest::getvar('cid', NULL, 'array');
     if (is_Array($cid)) {
         $virtuemart_paymentmethod_id = $cid[0];
     } else {
         $virtuemart_paymentmethod_id = $cid;
     }
     $http = JURI::root() . 'index.php?option=com_virtuemart&view=vmplg&task=notify&nt=ipn&tmpl=component&pm=' . $virtuemart_paymentmethod_id;
     $https = str_replace('http://', 'https://', $http);
     $string = '<div class="' . $this->class . '">';
     $string .= '<div class="ipn-sandbox">' . $http . ' <br /></div>';
     if (strcmp($https, $http) !== 0) {
         $string .= '<div class="ipn-sandbox">' . vmText::_('VMPAYMENT_AMAZON_OR') . '<br /></div>';
         $string .= $https;
     }
     $string .= "</div>";
     return $string;
 }
コード例 #29
0
ファイル: ErrorHandlerTest.php プロジェクト: luyadev/luya
 public function testExceptionArrayTrace()
 {
     try {
         $stud = new ErrorHandler();
         $response = $stud->getExceptionArray(['array', 'is', 'exception']);
         $this->assertArrayHasKey('message', $response);
         $this->assertArrayHasKey('file', $response);
         $this->assertArrayHasKey('line', $response);
         $this->assertArrayHasKey('requestUri', $response);
         $this->assertArrayHasKey('serverName', $response);
         $this->assertArrayHasKey('date', $response);
         $this->assertArrayHasKey('trace', $response);
         $this->assertArrayHasKey('ip', $response);
         $this->assertArrayHasKey('get', $response);
         $this->assertArrayHasKey('post', $response);
         $this->assertTrue(is_Array($response['trace']));
     } catch (Exception $e) {
         $this->assertEquals('Error: foobar', $e->getMessage());
     }
 }
コード例 #30
0
function podPress_stop_statistics($action = 'stop')
{
    $podpress_config = podPress_get_option('podPress_config');
    $do_update = FALSE;
    $result = FALSE;
    if (TRUE === is_Array($podpress_config) and TRUE === isset($podpress_config['enableStats'])) {
        switch ($action) {
            case 'stop':
                $podpress_config['enableStats'] = FALSE;
                $do_update = TRUE;
                break;
            case 'start':
                $podpress_config['enableStats'] = TRUE;
                $do_update = TRUE;
                break;
        }
        if (TRUE === $do_update) {
            $result = podPress_update_option('podPress_config', $podpress_config);
        }
    }
    echo '{ "code": "' . $podpress_config . ' - ' . $result . '" , "result": "' . $action . '" }';
}