当前位置: 首页>>代码示例>>PHP>>正文


PHP recur_sounds_dir函数代码示例

本文整理汇总了PHP中recur_sounds_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP recur_sounds_dir函数的具体用法?PHP recur_sounds_dir怎么用?PHP recur_sounds_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了recur_sounds_dir函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: recur_sounds_dir

function recur_sounds_dir($dir)
{
    global $dir_array;
    global $dir_path;
    $dir_list = opendir($dir);
    while ($file = readdir($dir_list)) {
        if ($file != '.' && $file != '..') {
            $newpath = $dir . '/' . $file;
            $level = explode('/', $newpath);
            if (substr($newpath, -4) == ".svn") {
                //ignore .svn dir and subdir
            } else {
                if (is_dir($newpath)) {
                    //directories
                    recur_sounds_dir($newpath);
                } else {
                    //files
                    if (strlen($newpath) > 0) {
                        //make the path relative
                        $relative_path = substr($newpath, strlen($dir_path), strlen($newpath));
                        //remove the 8000-48000 khz from the path
                        $relative_path = str_replace("/8000/", "/", $relative_path);
                        $relative_path = str_replace("/16000/", "/", $relative_path);
                        $relative_path = str_replace("/32000/", "/", $relative_path);
                        $relative_path = str_replace("/48000/", "/", $relative_path);
                        //remove the default_language, default_dialect, and default_voice (en/us/callie) from the path
                        $file_array = explode("/", $relative_path);
                        $x = 1;
                        $relative_path = '';
                        foreach ($file_array as $tmp) {
                            if ($x == 5) {
                                $relative_path .= $tmp;
                            }
                            if ($x > 5) {
                                $relative_path .= '/' . $tmp;
                            }
                            $x++;
                        }
                        //add the file if it does not exist in the array
                        if (isset($dir_array[$relative_path])) {
                            //already exists
                        } else {
                            //add the new path
                            if (strlen($relative_path) > 0) {
                                $dir_array[$relative_path] = '0';
                            }
                        }
                    }
                }
            }
        }
    }
    closedir($dir_list);
}
开发者ID:petekelly,项目名称:fusionpbx,代码行数:54,代码来源:v_ivr_menu_edit.php

示例2: foreach

if (count($result) > 0) {
    echo "<optgroup label='Phrases'>\n";
    foreach ($result as &$row) {
        if ($ivr_menu_exit_sound == "phrase:" . $row["phrase_uuid"]) {
            $tmp_selected = true;
            echo "\t<option value='phrase:" . $row["phrase_uuid"] . "' selected='selected'>" . $row["phrase_name"] . "</option>\n";
        } else {
            echo "\t<option value='phrase:" . $row["phrase_uuid"] . "'>" . $row["phrase_name"] . "</option>\n";
        }
    }
    unset($prep_statement);
    echo "</optgroup>\n";
}
//sounds
$dir_path = $_SESSION['switch']['sounds']['dir'];
recur_sounds_dir($_SESSION['switch']['sounds']['dir']);
if (count($dir_array) > 0) {
    echo "<optgroup label='Sounds'>\n";
    foreach ($dir_array as $key => $value) {
        if (strlen($value) > 0) {
            if (substr($ivr_menu_exit_sound, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") {
                $ivr_menu_exit_sound = substr($ivr_menu_exit_sound, 71);
            }
            if ($ivr_menu_exit_sound == $key) {
                $tmp_selected = true;
                echo "\t<option value='{$key}' selected='selected'>{$key}</option>\n";
            } else {
                echo "\t<option value='{$key}'>{$key}</option>\n";
            }
        }
    }
开发者ID:bdstephenson,项目名称:fusionpbx,代码行数:31,代码来源:ivr_menu_edit.php

示例3: sound_select_list

function sound_select_list($var, $name, $description_name, $load_sound = false)
{
    global $text, $recordings, $db;
    echo "<tr>\n";
    echo "<td class='vncell' valign='top' align='left' nowrap>\n";
    echo "\t" . $text['label-' . $description_name] . "\n";
    echo "</td>\n";
    echo "<td class='vtable' align='left'>\n";
    echo "<select name='{$name}' class='formfld' " . (if_group("superadmin") ? "onchange='changeToInput(this);'" : null) . ">\n";
    echo "\t<option value=''></option>\n";
    //misc optgroup
    if (if_group("superadmin")) {
        echo "<optgroup label=" . $text['miscellaneous'] . ">\n";
        echo "\t<option value='say:'>say:</option>\n";
        echo "\t<option value='tone_stream:'>tone_stream:</option>\n";
        echo "</optgroup>\n";
    }
    //recordings
    $tmp_selected = false;
    if (count($recordings) > 0) {
        echo "<optgroup label=" . $text['recordings'] . ">\n";
        foreach ($recordings as &$row) {
            $recording_name = $row["recording_name"];
            $recording_filename = $row["recording_filename"];
            if ($var == $_SESSION['switch']['recordings']['dir'] . "/" . $_SESSION['domain_name'] . "/" . $recording_filename && strlen($var) > 0) {
                $tmp_selected = true;
                echo "\t<option value='" . $_SESSION['switch']['recordings']['dir'] . "/" . $_SESSION['domain_name'] . "/" . $recording_filename . "' selected='selected'>" . $recording_name . "</option>\n";
            } else {
                if ($var == $recording_filename && strlen($var) > 0) {
                    $tmp_selected = true;
                    echo "\t<option value='" . $recording_filename . "' selected='selected'>" . $recording_name . "</option>\n";
                } else {
                    echo "\t<option value='" . $recording_filename . "'>" . $recording_name . "</option>\n";
                }
            }
        }
        echo "</optgroup>\n";
    }
    //phrases
    $sql = "select * from v_phrases where domain_uuid = '" . $domain_uuid . "' ";
    $prep_statement = $db->prepare(check_sql($sql));
    $prep_statement->execute();
    $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
    if (count($result) > 0) {
        echo "<optgroup label='Phrases'>\n";
        foreach ($result as &$row) {
            if ($var == "phrase:" . $row["phrase_uuid"]) {
                $tmp_selected = true;
                echo "\t<option value='phrase:" . $row["phrase_uuid"] . "' selected='selected'>" . $row["phrase_name"] . "</option>\n";
            } else {
                echo "\t<option value='phrase:" . $row["phrase_uuid"] . "'>" . $row["phrase_name"] . "</option>\n";
            }
        }
        unset($prep_statement);
        echo "</optgroup>\n";
    }
    //sounds
    if ($load_sound) {
        $files = recur_sounds_dir($_SESSION['switch']['sounds']['dir']);
        if (count($files) > 0) {
            echo "<optgroup label=" . $text["sounds"] . ">\n";
            foreach ($files as $key => $value) {
                if (strlen($value) > 0) {
                    if (substr($var, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") {
                        $var = substr($var, 71);
                    }
                    if ($var == $key) {
                        $tmp_selected = true;
                        echo "\t<option value='{$key}' selected='selected'>{$key}</option>\n";
                    } else {
                        echo "\t<option value='{$key}'>{$key}</option>\n";
                    }
                }
            }
            echo "</optgroup>\n";
        }
    }
    //select
    if (if_group("superadmin")) {
        if (!$tmp_selected && strlen($var) > 0) {
            echo "<optgroup label='Selected'>\n";
            if (file_exists($_SESSION['switch']['recordings']['dir'] . "/" . $_SESSION['domain_name'] . "/" . $var)) {
                echo "\t<option value='" . $_SESSION['switch']['recordings']['dir'] . "/" . $_SESSION['domain_name'] . "/" . $var . "' selected='selected'>" . $var . "</option>\n";
            } else {
                if (substr($var, -3) == "wav" || substr($var, -3) == "mp3") {
                    echo "\t<option value='" . $var . "' selected='selected'>" . $var . "</option>\n";
                } else {
                    echo "\t<option value='" . $var . "' selected='selected'>" . $var . "</option>\n";
                }
            }
            echo "</optgroup>\n";
        }
        unset($tmp_selected);
    }
    echo "\t</select>\n";
    echo "\t<br />\n";
    echo $text['description-' . $description_name] . "\n";
    echo "</td>\n";
    echo "</tr>\n";
}
开发者ID:powerpbx,项目名称:fusionpbx,代码行数:100,代码来源:call_flow_edit.php


注:本文中的recur_sounds_dir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。